The Learning PathwayActions Rulesand Simple and AdvancedWorkflow Integration UseCasesJörg Sauer
The longest title ever•  Actions, Rules and Simple and Advanced Workflow Integration Use Cases is about  o    Actions to e...
Basic Example to be extended•  Review Publish Workflow with 2 phase   approval           review               approve     ...
Simple Workflow              review               approve               publish1 Drafts       reject   2 Review           ...
Demo Simple Workflow
Adding Status•  Content Model:  o    Provide custom Aspect to hold workflow status
Amend Workflow with status•  Set Status on each workflow folder      o    Add Aspect: Workflow Status      o    Set workfl...
After configuration
Transfer Status to incoming documents•  JavaScript to copy status•  Execute by Rule
Simple Workflow Status Demo
Alfresco Repository Actions•  Action: Unit of work that is performed against a node•  Examples:   o    Move node   o    Tr...
Implement Copy Workflow Status Action
Deploy Action (Application Context)•  Beans: webinar-action-context.xml•  Labels: webinar-action.properties
Simple Workflow: Implementation Details•  Documents amended with properties for  o    Approve step label, copy/move, desti...
Intention: Create User Task  o    Every time simple workflow is assigned, create       advanced workflow task for specific...
Simple Workflow Task Architecture•  Required:  o    Custom aspect for task description.       (attached to simple workflow...
Workflow Description Aspect
Simple Workflow Task Advanced Workflow
Content Model for Workflow•  Aspects:   o    simpleWorflow: Manage Action Labels•  Content Types:   o    simpleWfTaskStart...
Workflow Model (partial)
Simple Process Definition•  Create Process Definition  o    Graphically  o    Change root tag:  o    Add Swimlanes  o    A...
Workflow Deployment•  Attention: No actions implemented yet!•  But want to check if model is correct &   workflow deploys•...
Workflow Actions•  User decides in task to  o    Approve  o    Reject•  Workflow will transition to nodes  o    approveDoc...
Code (sneaking)•  UI has actions for approve/reject•  Look for action definition in web-client-     config-actions.xml•  S...
Review Alfresco implementation•  DocumentDetailsDialog.approve()
Direct Code reuse•  Problem:  o    From Package org.alfresco.web.bean  o    Workflow Event not within web context.  o    D...
Lets get the event•  Define in Process Definition•  Derive from JBPMSpringActionHandler
What to Implement Where•  initializeHandler():  o    Get all services needed from the factory        •  ServiceRegistry   ...
Hiding Reject Transition if Not Set•  Hide reject transition accordingly  o    task-assign event (has to be this event!)  ...
Testing First Version•  Redeploy•  Manually start Simple Workflow Task workflow•  Fill in all details in the start form•  ...
What’s Missing•  Action to start Simple Workflow Task Workflow  o    Repository Action•  UI to fill in Assignee in Rules C...
Life Code Review in IDE•  JavaScript to start workflow•  Action Executer•  Action Handler•  Event Implementation
Final Demo•  Configured Simple Workflow•  Add Rule to kick off Simple Workflow Task     Workflow•    Push Document into fo...
Resume•  Actions extend Alfresco•  Simple workflows can be configured easily•  Rules are the binding glue•  Small advanced...
Resources•  Training   o    Alfresco API Development Course (3 days)   o    Alfresco Workflow Course (2 days)•  Alfresco (...
Questions?Email:       joerg.sauer@averi.deTwitter:     joergsauerIn Person:   DevCon 2011 London
Have you got your ticket yet?                 DevCon Americas 2011      26-27th October at the Hard Rock Hotel, San Diego,...
Upcoming SlideShare
Loading in...5
×

Actions rules and workflow in alfresco

9,252

Published on

Slide deck to accompany webinar on September 21st

Published in: Technology

Actions rules and workflow in alfresco

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

    Clipping is a handy way to collect important slides you want to go back to later.

×