
META-INF.definitions.single-approver-definition-scripted-assignment.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.portal.workflow.kaleo.runtime.impl Show documentation
Show all versions of com.liferay.portal.workflow.kaleo.runtime.impl Show documentation
Liferay Portal Workflow Kaleo Runtime Implementation
<?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>Scripted 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> <default>true</default> </transition> </transitions> </state> <task> <name>update</name> <metadata> <![CDATA[{"transitions":{"resubmit":{"bendpoints":[[303,140]]}},"xy":[328,199]}]]> </metadata> <actions> <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 Completion Notification</name> <template><![CDATA[Your submission was reviewed<#if taskComments?has_content> and the reviewer applied the following ${taskComments}</#if>.]]></template> <template-language>freemarker</template-language> <notification-type>email</notification-type> <recipients> <user /> </recipients> <execution-type>onExit</execution-type> </notification> <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> </actions> <assignments> <scripted-assignment> <script> <![CDATA[ import com.liferay.portal.kernel.model.Group; import com.liferay.portal.kernel.model.Role; import com.liferay.portal.kernel.service.GroupLocalServiceUtil; import com.liferay.portal.kernel.service.RoleLocalServiceUtil; import com.liferay.portal.kernel.util.GetterUtil; import com.liferay.portal.kernel.workflow.WorkflowConstants; long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID)); long groupId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_GROUP_ID)); Group group = GroupLocalServiceUtil.getGroup(groupId); roles = new ArrayList<Role>(); Role adminRole = RoleLocalServiceUtil.getRole(companyId, "Administrator"); roles.add(adminRole); if (group.isOrganization()) { Role role = RoleLocalServiceUtil.getRole(companyId, "Organization Content Reviewer"); roles.add(role); } else { Role role = RoleLocalServiceUtil.getRole(companyId, "Site Content Reviewer"); roles.add(role); } user = null; ]]> </script> <script-language>groovy</script-language> </scripted-assignment> </assignments> <transitions> <transition> <name>approve</name> <target>approved</target> <default>true</default> </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.getLabelStatus("approved"), workflowContext); ]]> </script> <script-language>groovy</script-language> <execution-type>onEntry</execution-type> </action> </actions> </state> </workflow-definition>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy