Liferay kaleo工作流程问题

时间:2016-06-24 12:48:11

标签: liferay workflow liferay-6 liferay-6.2

对于使用Web内容的单一审批者工作流程,我的用例非常简单。

  1. 用户创建网络内容
  2. 进行审核
  3. 如果审稿人批准它显示
  4. 如果Reviewer拒绝,它应该被视为已拒绝且用户应该能够 再次提交以供审核
  5. 我在第4点遇到问题。

    当审稿人拒绝时,它会被拒绝。但是当创建的尝试重新编辑Web内容并“提交以供发布”时,它始终处于“草稿”模式。审稿人在他们的工作流程任务中没有得到任何任务。

    我正在使用liferay 6.2 ce ga 3.以下是我的工作流程定义。

    <?xml version="1.0"?>
    
    <workflow-definition
        xmlns="urn:liferay.com:liferay-workflow_6.2.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:liferay.com:liferay-workflow_6.2.0 http://www.liferay.com/dtd/liferay-workflow-definition_6_2_0.xsd"
    >
        <name>Single Approver</name>
        <description>A single approver can approve a workflow content.</description>
        <version>1</version>
        <state>
            <name>created</name>
            <metadata>
                <![CDATA[{"xy":[36,51]}]]>
            </metadata>
            <initial>true</initial>
            <transitions>
                <transition>
                    <name>review</name>
                    <target>review</target>
                </transition>
            </transitions>
        </state>
        <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);
                        ]]>
                    </script>
                    <script-language>javascript</script-language>
                    <execution-type>onAssignment</execution-type>
                </action>
                <notification>
                    <name>Creator Modification Notification</name>
                    <template>Your submission was rejected by ${userName}, please modify and resubmit.</template>
                    <template-language>freemarker</template-language>
                    <notification-type>email</notification-type>
                    <notification-type>user-notification</notification-type>
                    <execution-type>onAssignment</execution-type>
                </notification>
            </actions>
            <assignments>
                <user />
            </assignments>
            <transitions>
                <transition>
                    <name>resubmit</name>
                    <target>review</target>
                    <default>true</default>
                </transition>
            </transitions>
        </task>
        <task>
            <name>review</name>
            <metadata>
                <![CDATA[{"xy":[168,36]}]]>
            </metadata>
            <actions>
                <notification>
                    <name>Review Notification</name>
                    <template>${userName} sent you a ${entryType} for review in the workflow.</template>
                    <template-language>freemarker</template-language>
                    <notification-type>email</notification-type>
                    <notification-type>user-notification</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[
                            import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
                            import com.liferay.portal.kernel.workflow.WorkflowConstants;
    
                            WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.toStatus("approved"), workflowContext);
                        ]]>
                    </script>
                    <script-language>groovy</script-language>
                    <execution-type>onEntry</execution-type>
                </action>
            </actions>
        </state>
    </workflow-definition>
    

    我是否需要添加任何其他状态或操作来实现第4点?

2 个答案:

答案 0 :(得分:0)

不看你的XML(我在手机上回答这个问题),说明听起来就像是自动安装的单一审批人工作流程。您可以下载并检查此工作流的XML,并将其与当前的XML进行比较。

答案 1 :(得分:0)

我相信你会想要将状态设置为&#34;拒绝&#34;正如您在更新任务中已经完成的那样,但随后立即在同一个动作脚本中将状态设置为&#34; pending&#34;。

Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("pending"), workflowContext);