1

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

  1. 用户创建网页内容
  2. 它需要审查
  3. 如果审阅者批准它得到显示
  4. 如果审阅者拒绝,它应该被视为被拒绝,并且用户应该能够再次重新提交以供审阅

我在第 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 点?

4

2 回答 2

0

无需查看您的 XML(我在手机上回答此问题),该描述听起来就像自动安装的单个审批者工作流程。您可以下载并检查此工作流的 XML,并将其与您当前的 XML 进行比较。

于 2016-06-26T06:47:10.297 回答
0

我相信您会希望将状态设置为“拒绝”,就像您在更新任务中所做的那样,但随后立即在同一个操作脚本中,将状态设置为“待定”。

Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.toStatus("pending"), workflowContext);
于 2016-06-27T16:53:14.670 回答