Kaleo workflow in Liferay

7,574 views

Published on

Overview of kaleo workflow and lessons learnt from a big workflow implementation with liferay

Published in: Technology

Kaleo workflow in Liferay

  1. 1. Kaleo Workflow and Liferay portalOverview and lessons learntWillem VermeerWorth IT Den Haag
  2. 2. Kaleo Workflow“allows a user to define any number of simple tocomplex business processes/workflows, deploythem, and manage them through a portal interface.The processes have knowledge of users, groups androles. You don’t have to write a single line of codeto accomplish this: all you have to do is create asingle XML document.” WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  3. 3. TerminologyA workflow- is executed by an asynchronous engine- can be applied to Liferay Assets (including yourown)- consists of states, tasks, transitions, actions andnotifications Insert User Group Logo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  4. 4. Task assignationA task can be assigned to- a certain user- a roleImportant: only user with assigned task cantransition it to the next task or state Insert User Group Logo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  5. 5. Example user start submit reject submit state reviewer task review accept acceptedtransition roleInsert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  6. 6. Workflow in action demoInsert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  7. 7. Workflow DefinitionLiferay EE has a graphical editor to create/modifyworkflowsLiferay CE has XML Insert User Group Logo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  8. 8. Workflow definition part 1<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.0http://www.liferay.com/dtd/liferay-workflow-definition_6_1_0.xsd"> <name>LNLUG Demo</name> <description>Two role, two tasks workflowexample</description> <version>1</version> <state> <name>created</name> <initial>true</initial> <transitions> <transition> <name>submit</name> <target>submit</target> </transition> </transitions> </state>Insert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  9. 9. Workflow definition part 2 <task> <name>submit</name> <actions> <action> <name>submit</name> <script> <![CDATA[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> </actions> <assignments> <user /> </assignments> <transitions> <transition> <name>submit</name> <target>review</target> </transition> </transitions> </task>Insert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  10. 10. Workflow definition part 3 <task> <name>review</name> <actions> <notification> <name>Review Notification</name> <template>You have a new submission waiting for yourreview in the workflow.</template> <template-language>text</template-language> <notification-type>email</notification-type> <execution-type>onAssignment</execution-type> </notification> </actions> <assignments> <roles> <role> <role-type>regular</role-type> <name>Application Reviewer</name> </role> </roles> </assignments> <transitions> <transition> <name>approve</name> <target>approved</target> </transition> <transition> <name>reject</name> <target>submit</target> <default>false</default> </transition> </transitions> </task>Insert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  11. 11. Workflow definition part 4 <state> <name>approved</name> <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>Insert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  12. 12. How to apply a workflow to a custom asset Workflow engine WorkflowHandler Your portlet appInsert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  13. 13. Workflow handlerpublic abstract interface WorkflowHandler { public abstract java.lang.String getTitle( long assetId, Locale locale); public abstract java.lang.Object updateStatus( int status, Map workflowContext) throws PortalException, SystemException; // more...}Insert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  14. 14. Demo appCreateApplication portlet to make and submit anapplicationListApplication portlet to display overview ofapplicationsUses control panel for task transitions demoInsert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  15. 15. Things to like about Kaleo workflowNice, deep integration with Liferay (users, roles)Control panel access to workflow tasksSimplicityInsert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  16. 16. Room for improvementExtensibility- limited to scripting in workflow definitionFlexibility- cant change definition once a workflow has startedThread safety- workflow engine is 100% thread UNsafeError recovery- Whats wrong with my XML?Insert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY
  17. 17. Questions? @willemvermeerInsert User GroupLogo (please resize) WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY

×