Liferay工作流程流程(即:Kaleo WorkFlow)

时间:2015-05-23 08:11:08

标签: liferay

我有一个要求。我们有一个表单,我们在liferay中创建用户,它应该通过审批流程(即:单一审批人)。如果omni管理员填写该表单,那么用户不得通过审批流程,何时任何其他用户都必须访问相同的表单,它必须通过审批流程。对此我不熟悉 有人可以帮我写xml或任何链接。

我需要像这个链接中提到的相同的reuiremnt。

liferayaddicts.net/blogs / - /博客/有条件过渡合的liferay-工作流使用默认-kaleo引擎

2 个答案:

答案 0 :(得分:1)

我使用了以下工作流程XML代码

<workflow-definition
    xmlns="urn:liferay.com:liferay-workflow_6.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:liferay.com:liferay-workflow_6.1.0 http://www.liferay.com/dtd/liferay-workflow-definition_6_1_0.xsd"
>
    <name>Sample</name>
    <description>A single approver can approve a workflow content.</description>
    <version>10</version>
    <state>
        <name>created</name>
        <metadata>
            <![CDATA[{"xy":[36,51]}]]>
        </metadata>
        <initial>true</initial>
        <transitions>
            <transition>
                <name>Determine Review</name>
                <target>review-or-approve</target>
                <default>true</default>
            </transition>
        </transitions>
    </state>
     <condition>
         <name>review-or-approve</name>
         <script> <![CDATA[
                         import com.liferay.portal.service.RoleLocalServiceUtil;
                         import com.liferay.portal.kernel.util.GetterUtil;
                         import com.liferay.portal.kernel.workflow.WorkflowConstants;
                         try {
                                 returnValue = "Review";
                                 long userid = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID));
                                 long companyid = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
                                 String[] roles={"JSM Admin"};
                                if (RoleLocalServiceUtil.hasUserRoles(userid, companyid, roles, true)) returnValue = "Approved";
                         } catch (Exception e) {
                           e.printStackTrace();
                         }
                    ]]> 
            </script>
         <script-language>beanshell</script-language>
        <transitions>
                 <transition>
                         <name>Review</name>
                         <target>review</target>
                         <default>false</default>
                 </transition>
                 <transition>
                         <name>Approved</name>
                         <target>approved</target>
                         <default>false</default>
                 </transition>
         </transitions>
     </condition>
    <task>
        <name>update</name>
        <metadata>
            <![CDATA[{"transitions":{"resubmit":{"bendpoints":[[303,140]]}},"xy":[328,199]}]]>
        </metadata>
        <actions>
            <action>
                <name>reject</name>
                <script>
                    <![CDATA[
                        Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("denied"), workflowContext);
                        Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("pending"), workflowContext);
                    ]]>
                </script>
                <script-language>javascript</script-language>
                <execution-type>onAssignment</execution-type>
            </action>
            <notification>
                <name>Creator Modification Notification</name>
                <template>Your submission was rejected by a reviewer, please modify and resubmit.</template>
                <template-language>text</template-language>
                <notification-type>email</notification-type>
                <execution-type>onAssignment</execution-type>
            </notification>
        </actions>
        <assignments>
            <user />
        </assignments>
        <transitions>
            <transition>
                <name>resubmit</name>
                <target>review</target>
            </transition>
        </transitions>
    </task>
    <task>
        <name>review</name>
        <metadata>
            <![CDATA[{"xy":[168,36]}]]>
        </metadata>
        <actions>
            <notification>
                <name>Review Notification</name>
                <template>You have a new submission waiting for your review in the workflow.</template>
                <template-language>text</template-language>
                <notification-type>email</notification-type>
                <execution-type>onAssignment</execution-type>
            </notification>
            <notification>
                <name>Review Completion Notification</name>
                <template>
                    Your submission has been reviewed and the reviewer has applied the following ${taskComments}.</template>
                <template-language>freemarker</template-language>
                <notification-type>email</notification-type>
                <recipients>
                    <user />
                </recipients>
                <execution-type>onExit</execution-type>
            </notification>
        </actions>
        <assignments>
            <roles>
                <role>
                    <role-type>organization</role-type>
                    <name>Organization Administrator</name>
                </role>
                <role>
                    <role-type>organization</role-type>
                    <name>Organization Content Reviewer</name>
                </role>
                <role>
                    <role-type>organization</role-type>
                    <name>Organization Owner</name>
                </role>
                <role>
                    <role-type>regular</role-type>
                    <name>Administrator</name>
                </role>
                <role>
                    <role-type>regular</role-type>
                    <name>Portal Content Reviewer</name>
                </role>
                <role>
                    <role-type>site</role-type>
                    <name>Site Administrator</name>
                </role>
                <role>
                    <role-type>site</role-type>
                    <name>Site Content Reviewer</name>
                </role>
                <role>
                    <role-type>site</role-type>
                    <name>Site Owner</name>
                </role>
            </roles>
        </assignments>
        <transitions>
            <transition>
                <name>approve</name>
                <target>approved</target>
            </transition>
            <transition>
                <name>reject</name>
                <target>update</target>
                <default>false</default>
            </transition>
        </transitions>
    </task>
    <state>
        <name>approved</name>
        <metadata>
            <![CDATA[
                {"xy":[380,51]}
            ]]>
        </metadata>
        <actions>
            <action>
                <name>approve</name>
                <script>
                    <![CDATA[
                        Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("approved"), workflowContext);
                    ]]>
                </script>
                <script-language>javascript</script-language>
                <execution-type>onEntry</execution-type>
            </action>
        </actions>
    </state>
</workflow-definition>

对于想要使用工作流程的其他人可能会有所帮助

答案 1 :(得分:0)

您可以为此编写工作流程xml。 link用于教程