The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases
-
Upload
jsauer -
Category
Technology
-
view
856 -
download
1
description
Transcript of The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases
![Page 1: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/1.jpg)
The Learning PathwayActions Rules and Simple and Advanced Workflow Integration Use Cases
Jörg Sauer
![Page 2: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/2.jpg)
The longest title ever
• Actions, Rules and Simple and Advanced Workflow Integration Use Casesis abouto Actions to extend Alfresco functionalityo Rules to automate execution of Actionso 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
![Page 3: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/3.jpg)
Basic Example to be extended
• Review Publish Workflow with 2 phase approval
1 Drafts 2 Review 3 Approve 4 Published
review
reject
approve
publish
reject
![Page 4: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/4.jpg)
Simple Workflow
• Pros:o User can build workflowo Easy to understand
• Cons:o No State: Implicit state by location (folder)o No Task: Implicit task by folder accesso No branching: Serial workflow only
1 Drafts 2 Review 3 Approve 4 Published
review
reject
approve
publish
reject
![Page 5: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/5.jpg)
Demo Simple Workflow
![Page 6: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/6.jpg)
Adding Status
• Content Model:o Provide custom Aspect to hold workflow status
![Page 7: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/7.jpg)
Amend Workflow with status
• Set Status on each workflow foldero Add Aspect: Workflow Statuso Set workflow status accordingly
1 Drafts 2 Review 3 Approve 4 Published
review
approve
publish
reject
reject
• Status: draft • Status: under review
• Status: pend. approval
• Status: published
![Page 8: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/8.jpg)
After configuration
![Page 9: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/9.jpg)
Transfer Status to incoming documents
• JavaScript to copy status
• Execute by Rule
![Page 10: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/10.jpg)
Simple Workflow Status Demo
![Page 11: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/11.jpg)
Alfresco Repository Actions
• Action: Unit of work that is performed against a node
• Examples:o Move nodeo Transform content of nodeo Send email
• Out of the Box Actions• Custom Actions
o Implement own Action classo Deploy in Application Context
![Page 12: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/12.jpg)
Implement Copy Workflow Status Action
![Page 13: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/13.jpg)
Deploy Action (Application Context)
• Beans: webinar-action-context.xml
• Labels: webinar-action.properties
![Page 14: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/14.jpg)
Simple Workflow: Implementation Details
• Documents amended with properties foro Approve step label, copy/move, destinationo Reject step label, copy/move, destination
(all optional)
![Page 15: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/15.jpg)
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
![Page 16: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/16.jpg)
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 StartWorkflowActionExecutero UI for Rule Config
![Page 17: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/17.jpg)
Workflow Description Aspect
![Page 18: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/18.jpg)
Simple Workflow Task Advanced Workflow
![Page 19: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/19.jpg)
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 documento ApproveOrRejectTask: Properties for approving or rejecting the
document
• Simplicity: all in sample model• Best practice: own workflow model
![Page 20: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/20.jpg)
Workflow Model (partial)
![Page 21: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/21.jpg)
Simple Process Definition
• Create Process Definitiono Graphicallyo Change root tag:
o Add Swimlanes
o Add tasks to task node, will render UI
![Page 22: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/22.jpg)
Workflow Deployment
• Attention: No actions implemented yet!• But want to check if model is correct &
workflow deploys• Context file:
• Redeploy off on production systems!
![Page 23: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/23.jpg)
Workflow Actions
• User decides in task too Approveo Reject
• Workflow will transition to nodeso approveDocument: code will approve simple
workflowo rejectDocument: code will reject simple workflow
• Todo: Implement Event Handlero for node-enter event (approve / reject)
![Page 24: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/24.jpg)
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!
![Page 25: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/25.jpg)
Review Alfresco implementation
• DocumentDetailsDialog.approve()
![Page 26: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/26.jpg)
Direct Code reuse
• Problem: o From Package org.alfresco.web.beano Workflow Event not within web context.o DocNode not core object
• Solution:o Reprogram but use native Foundation Services APIo Should be fool proof ;-)
![Page 27: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/27.jpg)
Lets get the event
• Define in Process Definition
• Derive from JBPMSpringActionHandler
![Page 28: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/28.jpg)
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 executionContexto Implement the approve / reject action
![Page 29: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/29.jpg)
Hiding Reject Transition if Not Set
• Hide reject transition accordinglyo task-assign event (has to be this event!)o use bpm:hiddenTransitions (bpm_hiddenTransitions)
![Page 30: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/30.jpg)
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.
![Page 31: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/31.jpg)
What’s Missing
• Action to start Simple Workflow Task Workflowo Repository Action
• UI to fill in Assignee in Rules Configurationo Action Handler
• Simple approach: o Use JavaScript to start Workflow
• Either fixed assignee or• assignee is property of folder
![Page 32: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/32.jpg)
JavaScript to start workflow
![Page 33: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/33.jpg)
Life Code Review in IDE
• JavaScript to start workflow• Action Executer• Action Handler• Event Implementation
![Page 34: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/34.jpg)
Final Demo
• Configured Simple Workflow• Add Rule to kick off Simple Workflow Task
Workflow• Push Document into folder with simple
workflow.o Review document statuso Search for documents with statuso Review task list
• Manage taskso See documents transition through simple workflow by using
advanced workflows functionality
![Page 35: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/35.jpg)
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.
![Page 36: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/36.jpg)
Resources
• Trainingo Alfresco API Development Course (3 days)o Alfresco Workflow Course (2 days)
• Alfresco (API) Documentationo http://docs.alfresco.com/3.4/index.jsp
• Wiki Resourceso http://wiki.alfresco.com/wiki/Data_Dictionary_Guideo http://wiki.alfresco.com/wiki/Custom_Actionso http://wiki.alfresco.com/wiki/Custom_Action_UIo http://wiki.alfresco.com/wiki/Workflowo http://wiki.alfresco.com/wiki/WorkflowAdministration
• Bookso Alfresco Developer Guide (Packt Publishing)o Professional Alfresco (Wrox Press)
![Page 38: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/38.jpg)
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 20119-10th November at Prospero House, Central London, UK
Get some preconference training in on 8th Novemberchoose from Jump Start or Advanced Alfresco
![Page 39: The Learning Pathway: Actions, Rules and Simple and Advanced Workflow Integration Use Cases](https://reader036.fdocuments.us/reader036/viewer/2022062616/54b601064a795954558b464c/html5/thumbnails/39.jpg)
The open platform forsocial content management.