The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases


Published on

Slide deck, for the webinar presented on 21st of September 2011 in the

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases

  1. 1. The Learning PathwayActions Rules and Simple and Advanced Workflow Integration Use CasesJörg Sauer<br />
  2. 2. The longest title ever<br />Actions, Rules and Simple and Advanced Workflow Integration Use Casesis about<br />Actions to extend Alfresco functionality<br />Rules to automate execution of Actions<br />Use Simple Workflows to implement a Workflow without coding<br />Add Rules to run certain Actions in Workflow steps<br />Use a simple Advanced Workflow to leverage Tasks in Simple Workflows<br />
  3. 3. Basic Example to be extended<br />Review Publish Workflow with 2 phase approval<br />review<br />approve<br />publish<br />reject<br />1 Drafts<br />3 Approve<br />4 Published<br />2 Review<br />reject<br />
  4. 4. Simple Workflow<br />Pros:<br />User can build workflow<br />Easy to understand<br />Cons:<br />No State: Implicit state by location (folder)<br />No Task: Implicit task by folder access<br />No branching: Serial workflow only<br />review<br />approve<br />publish<br />reject<br />1 Drafts<br />3 Approve<br />4 Published<br />2 Review<br />reject<br />
  5. 5. Demo Simple Workflow<br />
  6. 6. Adding Status<br />Content Model:<br />Provide custom Aspect to hold workflow status<br />
  7. 7. Amend Workflow with status<br />Set Status on each workflow folder<br />Add Aspect: Workflow Status<br />Set workflow status accordingly<br />reject<br />review<br />approve<br />publish<br />reject<br />1 Drafts<br />3 Approve<br />4 Published<br />2 Review<br /><ul><li>Status: draft
  8. 8. Status: under review
  9. 9. Status: pend. approval
  10. 10. Status: published</li></li></ul><li>After configuration<br />
  11. 11. Transfer Status to incoming documents<br />JavaScript to copy status<br />Execute by Rule<br />
  12. 12. Simple Workflow Status Demo<br />
  13. 13. Alfresco Repository Actions<br />Action: Unit of work that is performed against a node<br />Examples:<br />Move node<br />Transform content of node<br />Send email<br />Out of the Box Actions<br />Custom Actions<br />Implement own Action class<br />Deploy in Application Context<br />
  14. 14. Implement Copy Workflow Status Action<br />
  15. 15. Deploy Action (Application Context)<br />Beans: webinar-action-context.xml<br />Labels:<br />
  16. 16. Simple Workflow: Implementation Details<br />Documents amended with properties for<br />Approve step label, copy/move, destination<br />Reject step label, copy/move, destination(all optional)<br />
  17. 17. Intention: Create User Task<br />Every time simple workflow is assigned, create advanced workflow task for specific user.<br />User can<br />access task in task list<br />see task description<br />access attached document<br />approve or reject directly from within task<br />Advantage<br />No notification emails<br />No need to check simple workflow folders<br />
  18. 18. Simple Workflow Task Architecture<br />Required:<br />Custom aspect for task description.(attached to simple workflow folder)<br />Advanced workflow to be started by rule<br />Configure user<br />Provide task<br />Implement simple workflow actions for<br />Approve<br />Reject<br />Bug Fix for Alfresco StartWorkflowActionExecuter<br />UI for Rule Config<br />
  19. 19. Workflow Description Aspect<br />
  20. 20. Simple Workflow Task Advanced Workflow<br />
  21. 21. Content Model for Workflow<br />Aspects:<br />simpleWorflow: Manage Action Labels<br />Content Types:<br />simpleWfTaskStart: Properties for Start Task<br />Assignee<br />Task Description<br />Simple Workflow Approve & Reject Action Labels<br />All above become process variables!<br />ApprovalOnlyTask: Task properties to approve document<br />ApproveOrRejectTask: Properties for approving or rejecting the document<br />Simplicity: all in sample model<br />Best practice: own workflow model <br />
  22. 22. Workflow Model (partial)<br />
  23. 23. Simple Process Definition<br />Create Process Definition<br />Graphically<br />Change root tag: <br />Add Swimlanes<br />Add tasks to task node, will render UI<br />
  24. 24. Workflow Deployment<br />Attention: No actions implemented yet!<br />But want to check if model is correct &workflow deploys<br />Context file:<br />Redeploy off on production systems!<br />
  25. 25. Workflow Actions<br />User decides in task to<br />Approve<br />Reject<br />Workflow will transition to nodes<br />approveDocument: code will approve simple workflow<br />rejectDocument: code will reject simple workflow<br />Todo: Implement Event Handler<br />for node-enter event(approve / reject)<br />
  26. 26. Code (sneaking)<br />UI has actions for approve/reject<br />Look for action definition in web-client-config-actions.xml<br />Sample implementation can be found in DocumentDetailsDialog.approve() / reject() methods!<br />OpenSource Rules!<br />
  27. 27. Review Alfresco implementation<br />DocumentDetailsDialog.approve()<br />
  28. 28. Direct Code reuse<br />Problem: <br />From Package org.alfresco.web.bean<br />Workflow Event not within web context.<br />DocNode not core object<br />Solution:<br />Reprogram but use native Foundation Services API<br />Should be fool proof ;-)<br />
  29. 29. Lets get the event<br />Define in Process Definition<br />Derive from JBPMSpringActionHandler<br />
  30. 30. What to Implement Where<br />initializeHandler():<br />Get all services needed from the factory<br />ServiceRegistry (in case you need something)<br />NodeService to deal with the node<br />CopyService to copy/move the document<br />execute():<br />Get the process variables through executionContext<br />Implement the approve / reject action<br />
  31. 31. Hiding Reject Transition if Not Set<br />Hide reject transition accordingly<br />task-assign event (has to be this event!)<br />use bpm:hiddenTransitions (bpm_hiddenTransitions)<br />
  32. 32. Testing First Version<br />Redeploy<br />Manually start Simple Workflow Task workflow<br />Fill in all details in the start form<br />Test both scenarios: <br />Approval only (reject transition hidden?)<br />Approve or Reject<br />Task should show up in task list<br />Open Task and pick Action<br />Check if document has been moved / copied according to Simple Workflow configuration.<br />
  33. 33. What’s Missing<br />Action to start Simple Workflow Task Workflow<br />Repository Action<br />UI to fill in Assignee in Rules Configuration<br />Action Handler<br />Simple approach: <br />Use JavaScript to start Workflow<br />Either fixed assignee or<br />assignee is property of folder <br />
  34. 34. JavaScript to start workflow<br />
  35. 35. Life Code Review in IDE<br />JavaScript to start workflow<br />Action Executer<br />Action Handler<br />Event Implementation<br />
  36. 36. Final Demo<br />Configured Simple Workflow<br />Add Rule to kick off Simple Workflow Task Workflow<br />Push Document into folder with simple workflow.<br />Review document status<br />Search for documents with status<br />Review task list<br />Manage tasks<br />See documents transition through simple workflow by using advanced workflows functionality<br />
  37. 37. Resume<br />Actions extend Alfresco<br />Simple workflows can be configured easily<br />Rules are the binding glue<br />Small advanced workflows can be leveraged in actions and simple workflows.<br />Your imagination is the border<br />Alfresco OpenSource helps you to code and find solutions to your problems.<br />
  38. 38. Resources<br />Training<br />Alfresco API Development Course (3 days)<br />Alfresco Workflow Course (2 days)<br />Alfresco (API) Documentation<br /><br />Wiki Resources<br /><br /><br /><br /><br /><br />Books<br />Alfresco Developer Guide (Packt Publishing)<br />Professional Alfresco (Wrox Press) <br />
  39. 39. Questions?<br />Email:<br />Twitter: joergsauer<br />In Person: DevCon 2011 London<br />
  40. 40. Have you got your ticket yet?<br />DevCon Americas 201126-27th October at the Hard Rock Hotel, San Diego, CA<br />Get some preconference training in on 25th October choose from Jump Start or Advanced Alfresco<br />∞∞∞∞∞∞∞∞∞<br />DevCon EMEA & APAC 20119-10th November at Prospero House, Central London, UKGet some preconference training in on 8th Novemberchoose from Jump Start or Advanced Alfresco<br />