Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

OpenACS Workflow

8,493 views

Published on

Learn to use an OpenACS workflow in a web application.

Published in: Technology
  • Be the first to like this

OpenACS Workflow

  1. 1. OpenACS Workflow Mark Aufflick pumptheory.com
  2. 2. This presentation <ul><li>Goal: Learn to use a workflow in a web application </li></ul><ul><li>The OpenACS Workflow package </li></ul><ul><li>Roles, Cases, Actions & States </li></ul><ul><li>Defining a workflow </li></ul><ul><li>Integrating a workflow with your app </li></ul>
  3. 3. A Brief History <ul><li>The original ACS Workflow package was designed using Petri Nets as the underlying formal model </li></ul><ul><li>It’s design was very thorough, but the use of Petri Nets was overcomplicated and unnecessary in perhaps 95% of use cases </li></ul><ul><li>In 2003 Lars Pind of Collaboraid didn’t use the existing workflow package because it was cumbersome and unfinished – even though he was the original author while working for ArsDigita! </li></ul>
  4. 4. The new Workflow <ul><li>An analysis of common use cases showed that all common business workflows can be modeled with a simple Finite State Machine </li></ul><ul><li>The new workflow package is a modular development framework, and allows multiple workflow models to be used </li></ul><ul><li>Initially only FSMs are supported </li></ul>
  5. 5. User Interface? <ul><li>Many workflow packages, including the original ACS Workflow, have funky UIs </li></ul><ul><li>But – development is nearly always required </li></ul><ul><li>So – the new workflow has been designed as a developer framework that allows the power of workflows to be easily incorporated into applications </li></ul>
  6. 6. Workflow Overview <ul><li>A workflow is a set of: </li></ul><ul><ul><li>Roles </li></ul></ul><ul><ul><li>Actions </li></ul></ul><ul><ul><li>States </li></ul></ul><ul><ul><li>plus their relations </li></ul></ul><ul><li>A workflow is associated with an object type </li></ul>
  7. 7. Cases <ul><li>A workflow in action is a CASE </li></ul><ul><li>A case revolves around a specific object </li></ul><ul><li>A case holds information about: </li></ul><ul><ul><li>Current state </li></ul></ul><ul><ul><li>Current assignments </li></ul></ul><ul><ul><li>Activity log </li></ul></ul>
  8. 8. Roles <ul><li>From our publishing example, roles might be: </li></ul><ul><ul><li>Author </li></ul></ul><ul><ul><li>Editor </li></ul></ul><ul><ul><li>Publisher </li></ul></ul><ul><li>Roles convey permission and responsibility </li></ul><ul><li>Roles can be assigned by default and reassigned </li></ul>
  9. 9. Actions <ul><li>Which actions are available will depend on the current state </li></ul><ul><li>Actions may change the state </li></ul><ul><li>Actions can have side effects </li></ul><ul><li>Allowed roles control who can perform what actions </li></ul><ul><li>Assigned roles indicate who is responsible for the action </li></ul><ul><li>A workflow has an initial action </li></ul>
  10. 10. States <ul><li>A workflow has a finite set of states </li></ul><ul><li>From our bug tracker example: </li></ul><ul><ul><li>Open </li></ul></ul><ul><ul><li>Resolved </li></ul></ul><ul><ul><li>Closed </li></ul></ul><ul><li>A case will always be in exactly one state </li></ul><ul><li>States contain almost no information </li></ul>
  11. 11. Defining a workflow <ul><li>Start by drawing a diagram </li></ul><ul><li>-> your states, actions and roles </li></ul>set spec { contract { pretty_name &quot;Contract&quot; package_key &quot;finance-contracts&quot; object_type “finance_contract“ roles { } states { } actions { } } }
  12. 12. Defining a workflow: Roles roles { submitter { pretty_name &quot;Submitter&quot; call_backs { workflow.Role_DefaultAssignees_CreationUser } } assignee { pretty_name “Assignee” callbacks { bug-tracker.ComponentMaintainer bug-tracker.ProjectMaintainer workflow.Role_PickList_CurrentAssignees workflow.Role_AssigneeSubquery_RegisteredUsers } } }
  13. 13. Defining a workflow: States submitted { pretty_name &quot;Submitted“ hide_fields { date_approval date_settlement } } approved { pretty_name &quot;Approved&quot; hide_fields { date_settlement } } declined { pretty_name &quot;Declined&quot; hide_fields { date_settlement } } settled { pretty_name &quot;Settled&quot; } discarded { pretty_name &quot;Discarded&quot; }
  14. 14. Defining a workflow: Actions (1) submit { pretty_name &quot;Submit&quot; pretty_past_tense &quot;Submitted&quot; new_state &quot;submitted&quot; initial_action_p t } comment { pretty_name &quot;Comment&quot; pretty_past_tense &quot;Commented&quot; allowed_roles { submitter } priviliges { read write } always_enabled_p t }
  15. 15. Defining a workflow: Actions (2) decline { pretty_name &quot;Decline&quot; pretty_past_tense &quot;Declined&quot; assigned_role &quot;submitter&quot; assigned_states { submitted } new_state &quot;declined&quot; privileges { write } edit_fields { date_approval } } approve { pretty_name &quot;Approve&quot; pretty_past_tense &quot;Approved&quot; assigned_role &quot;submitter&quot; assigned_states { submitted } new_state &quot;approved&quot; privileges { write } edit_fields { date_approval } }
  16. 16. Integrating With Your App's API <ul><li>Creating new objects </li></ul><ul><ul><li>workflow::case::new </li></ul></ul><ul><li>Fetching data </li></ul><ul><ul><li>workflow::case::get </li></ul></ul><ul><li>Editing objects </li></ul><ul><ul><li>workflow::case::action::execute </li></ul></ul><ul><li>see packages/bug-tracker/tcl/bug-procs.tcl </li></ul>
  17. 17. Integrating with your App’s UI <ul><li>Bug Tracker demo… </li></ul><ul><li>Use ad_form to build the form fields </li></ul><ul><li>Workflow will give you: </li></ul><ul><ul><li>Action buttons ( workflow::case::get_available_actions) </li></ul></ul><ul><ul><li>Role assignment ( workflow::case::role::add_assignee_widgets ) </li></ul></ul><ul><ul><li>Case log ( workflow::case::get_activity_html ) </li></ul></ul><ul><li>See packages/bug-tracker/www/bug.tcl </li></ul>
  18. 18. Integrating with your app’s queries <ul><li>For complex view-only listings, stats etc. </li></ul><ul><li>Join with: </li></ul><ul><ul><li>workflow_cases </li></ul></ul><ul><ul><li>workflow_fsm_states </li></ul></ul><ul><ul><li>And others… </li></ul></ul><ul><li>See the bug-tracker index-postgresql.xql for an example </li></ul>
  19. 19. Service Contracts and Callback goodness <ul><li>What is a callback good for? </li></ul><ul><ul><li>Notifications </li></ul></ul><ul><ul><li>Other side effects </li></ul></ul><ul><li>What is a service contract? </li></ul><ul><ul><li>ACS Service contract allows packages to define and register implementation of interfaces </li></ul></ul><ul><ul><li>ACS Service contract provides mean to dispatch method calls on an interface implementation. </li></ul></ul><ul><ul><li>Interface Discovery is available programmatically </li></ul></ul><ul><ul><li>The Service Contract interface specification was inspired by WDSL, the interface specfication for web services. </li></ul></ul>
  20. 20. Package development details <ul><li>APM TCL callbacks: </li></ul><ul><ul><li>after-install (workflow::fsm::new_from_spec) </li></ul></ul><ul><ul><li>before-uninstall ( workflow::delete ) </li></ul></ul><ul><ul><li>before-upgrade </li></ul></ul><ul><ul><li>after-instantiate ( workflow::fsm::clone ) </li></ul></ul><ul><ul><li>before-uninstantiate( workflow::delete ) </li></ul></ul>
  21. 21. References <ul><li>All references, slides and materials will be posted on the internet at: </li></ul><ul><li>http://pumptheory.com/collaboration/open-acs/lectures/ </li></ul><ul><li>OpenACS Workflow documentation </li></ul><ul><li>http://www.collaboraid.biz/developer/workflow-spec </li></ul>

×