Skip to content

Instantly share code, notes, and snippets.

@ValentinBlokhin
Created January 18, 2016 21:59
Show Gist options
  • Select an option

  • Save ValentinBlokhin/2fa1ed3f0db5eb35e1d3 to your computer and use it in GitHub Desktop.

Select an option

Save ValentinBlokhin/2fa1ed3f0db5eb35e1d3 to your computer and use it in GitHub Desktop.
workflow state-to-state example
<?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>test1</name>
<description>
</description>
<version>1</version>
<state>
<name>StartNode</name>
<metadata>
<![CDATA[{"xy":[92,34]}]]>
</metadata>
<initial>true</initial>
<transitions>
<transition>
<name>call ws</name>
<target>call ws state</target>
<default>true</default>
</transition>
</transitions>
</state>
<state>
<name>EndNode</name>
<metadata>
<![CDATA[{"terminal":true,"xy":[100,500]}]]>
</metadata>
<actions>
<action>
<name>Approve</name>
<description>Approve</description>
<script>
<![CDATA[Packages.com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil.updateStatus(Packages.com.liferay.portal.kernel.workflow.WorkflowConstants.getLabelStatus("approved"), workflowContext);]]>
</script>
<script-language>javascript</script-language>
<execution-type>onEntry</execution-type>
</action>
</actions>
</state>
<state>
<name>send email</name>
<metadata>
<![CDATA[{"xy":[320,235]}]]>
</metadata>
<actions>
<action>
<name>test2</name>
<description>test2</description>
<script>
<![CDATA[println('sending email!')]]>
</script>
<script-language>groovy</script-language>
<execution-type>onEntry</execution-type>
</action>
</actions>
<transitions>
<transition>
<name>update status</name>
<target>update status state</target>
<default>true</default>
</transition>
</transitions>
</state>
<state>
<name>update status state</name>
<metadata>
<![CDATA[{"xy":[221,341]}]]>
</metadata>
<actions>
<action>
<name>test3</name>
<description>test3</description>
<script>
<![CDATA[println("updating status state")]]>
</script>
<script-language>groovy</script-language>
<execution-type>onEntry</execution-type>
</action>
</actions>
<transitions>
<transition>
<name>end connector</name>
<target>EndNode</target>
<default>true</default>
</transition>
</transitions>
</state>
<state>
<name>call ws state</name>
<metadata>
<![CDATA[{"xy":[263,49.609375]}]]>
</metadata>
<actions>
<action>
<name>test1</name>
<description>haha</description>
<script>
<![CDATA[println("call ws state!")]]>
</script>
<script-language>groovy</script-language>
<execution-type>onEntry</execution-type>
</action>
</actions>
<transitions>
<transition>
<name>send email to administrator</name>
<target>send email</target>
<default>true</default>
</transition>
</transitions>
</state>
</workflow-definition>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment