2. Presenter overview Willem Vermeer Java developer Based in The Netherlands Working for Worth IT Back-end oriented Liferay enthusiast 3. Presentation overview Kaleo Workflow overview + demo Integration with Orbeon forms + demo 4. Kaleo Workflow allows a user to define any number of simple to complex business processes/workflows, deploy them, and manage them through a portal interface. The processes have knowledge of users, groups and roles. You dont have to write a single line of code to accomplish this: all you have to do is create a single XML document. 5. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Prerequisites Install Kaleo from Marketplace (CE or EE) into your Liferay Installation 6. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Terminology A workflow - is a directed graph of states, tasks, transitions, actions and notifications - can be applied to Liferay Assets such as Web Content or even Custom Assets - is executed by an asynchronous engine 7. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Start and finish A workflow - starts in an initial state - must finish at the end state - can contain any number of tasks, including parallel tasks (fork-join) 8. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Task assignation A task can be assigned to - a certain user - a role Important: only user with assigned task can transition it to the next task or state 9. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Example start submit review accepted rejectstate task user reviewerrole transition accept submit 10. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow Definition Liferay EE has a graphical editor to create/modify workflows 11. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow Definition Liferay EE has a graphical editor to create/modify workflows pulled from marketplace From Liferay Support: Unfortunately we had to pull it from the Marketplace as many major issues were discovered with it. 12. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow Definition Liferay EE has a graphical editor to create/modify workflows Liferay CE has XML pulled from marketplace From Liferay Support: Unfortunately we had to pull it from the Marketplace as many major issues were discovered with it. 13. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow definition part 1 DevCon DemoWorkflow example1createdtruesubmitsubmit 14. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow definition part 2 submitsubmitjavascriptonAssignmentsubmitreview 15. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow definition part 3 reviewReview NotificationYou have a new submission waiting for your review in the workflow.textemailonAssignmentregularApplication Reviewer 16. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow definition part 4 approvedapprovejavascriptonEntry 17. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Demo app Extremely simplified version of customer case CreateApplication portlet to apply for a grant ListApplication portlet to display overview of applications DEMO 18. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY How to apply a workflow to a custom asset your portlet app WorkflowHandler workflow engine 19. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow handler declaration In liferay-portlet.xml add the following to your portlet: .. demo.workflow.ApplicationWorkflowHandler .. 20. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow handler public abstract interface WorkflowHandler { public String getClassName(); public abstract java.lang.Object updateStatus( int status, Map workflowContext) throws PortalException, SystemException; // more... } 21. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow handler implementation @Override public Object updateStatus(int status, Map workflowContext) throws PortalException, SystemException { Object applicationId = workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK); long appId = Long.parseLong(applicationId.toString()); Application application = ApplicationLocalServiceUtil.fetchApplication(appId); application.setStatus(status); return ApplicationLocalServiceUtil.updateApplication(application); } 22. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Workflow handler invocation submitjavascriptonAssignment 23. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY How to start the workflow ServiceContext serviceContext = ServiceContextFactory.getInstance( Application.class.getName(), request); Map context = new HashMap(); context.put(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME, Application.class.getName()); context.put(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK, Long.toString(app.getApplicationId())); context.put(WorkflowConstants.CONTEXT_SERVICE_CONTEXT, serviceContext); WorkflowInstanceManagerUtil.startWorkflowInstance( companyId, groupId, userId, workflowDefinitionName, workflowDefinitionVersion, phase, context); 24. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY How to move the workflow WorkflowTaskManagerUtil.completeWorkflowTask( companyId, owningUserId, workflowTaskId, nextPhase, // "submit" or "reject" or .. "comment", context ); 25. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY How to assign a task to a user WorkflowTaskManagerUtil.assignWorkflowTaskToUser( companyId, userId, // owner workflowTaskId, userId, // assignee "comment", dueDate, context // can be an empty Map ); 26. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY How to re-assign a task to another user long[] userIds = WorkflowTaskManagerUtil.getPooledActorsIds( companyId, workflowTaskId ); 27. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Integration with Orbeon XForms Orbeon Forms Builder & Forms Runner Proxy portlet to execute the form runner Combination with workflow 28. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Orbeon Xforms Builder Insert User Group Logo (please resize) 29. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Integration with Orbeon - architecture Insert User Group Logo (please resize) application group page proxy portlet custom portlet (drives workflow) javascript 30. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Integration with Orbeon - demo DEMO 31. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Things to like about Kaleo workflow Nice, deep integration with Liferay (users, roles) Control panel access to workflow tasks Simplicity 32. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Room for improvement Extensibility - limited to scripting in workflow definition Flexibility - can't change definition once a workflow has started Thread safety - workflow engine is thread UNsafe Error recovery - What's wrong with my XML? 33. WWW.LIFERAY.COM WWW.FACEBOOK.COOM/LIFERAY @LIFERAY Questions? @willemvermeer For more information on Orbeon please visit orbeon.com
Top Related