Top Banner
pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com
21

Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

Jan 12, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

OpenACS Workflow

Mark Aufflick

pumptheory.com

Page 2: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

This presentation

• Goal: Learn to use a workflow in a web application

• The OpenACS Workflow package

• Roles, Cases, Actions & States

• Defining a workflow

• Integrating a workflow with your app

Page 3: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

A Brief History

• The original ACS Workflow package was designed using Petri Nets as the underlying formal model

• It’s design was very thorough, but the use of Petri Nets was overcomplicated and unnecessary in perhaps 95% of use cases

• 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!

Page 4: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

The new Workflow

• An analysis of common use cases showed that all common business workflows can be modeled with a simple Finite State Machine

• The new workflow package is a modular development framework, and allows multiple workflow models to be used

• Initially only FSMs are supported

Page 5: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

User Interface?

• Many workflow packages, including the original ACS Workflow, have funky UIs

• But – development is nearly always required

• So – the new workflow has been designed as a developer framework that allows the power of workflows to be easily incorporated into applications

Page 6: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Workflow Overview

• A workflow is a set of:– Roles– Actions– States– plus their relations

• A workflow is associated with an object type

Page 7: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Cases

• A workflow in action is a CASE

• A case revolves around a specific object

• A case holds information about:– Current state– Current assignments– Activity log

Page 8: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Roles

• From our publishing example, roles might be:– Author– Editor– Publisher

• Roles convey permission and responsibility

• Roles can be assigned by default and reassigned

Page 9: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Actions

• Which actions are available will depend on the current state

• Actions may change the state• Actions can have side effects• Allowed roles control who can perform what

actions• Assigned roles indicate who is responsible for

the action• A workflow has an initial action

Page 10: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

States

• A workflow has a finite set of states

• From our bug tracker example:– Open– Resolved– Closed

• A case will always be in exactly one state

• States contain almost no information

Page 11: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Defining a workflow

• Start by drawing a diagram

• -> your states, actions and roles set spec { contract { pretty_name "Contract" package_key "finance-contracts" object_type “finance_contract“

roles { } states { } actions { } }

}

Page 12: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Defining a workflow: Rolesroles { submitter { pretty_name "Submitter" 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 } }}

Page 13: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Defining a workflow: States submitted { pretty_name "Submitted“ hide_fields { date_approval date_settlement } } approved { pretty_name "Approved" hide_fields { date_settlement } }

declined { pretty_name "Declined" hide_fields { date_settlement } } settled { pretty_name "Settled" } discarded { pretty_name "Discarded" }

Page 14: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Defining a workflow: Actions (1)submit { pretty_name "Submit" pretty_past_tense "Submitted" new_state "submitted" initial_action_p t}comment { pretty_name "Comment" pretty_past_tense "Commented" allowed_roles { submitter } priviliges { read write } always_enabled_p t}

Page 15: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Defining a workflow: Actions (2)decline { pretty_name "Decline" pretty_past_tense "Declined" assigned_role "submitter" assigned_states { submitted } new_state "declined" privileges { write } edit_fields { date_approval }}approve { pretty_name "Approve" pretty_past_tense "Approved" assigned_role "submitter" assigned_states { submitted } new_state "approved" privileges { write } edit_fields { date_approval }}

Page 16: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Integrating With Your App's API

• Creating new objects– workflow::case::new

• Fetching data– workflow::case::get

• Editing objects– workflow::case::action::execute

• see packages/bug-tracker/tcl/bug-procs.tcl

Page 17: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Integrating with your App’s UI

• Bug Tracker demo…• Use ad_form to build the form fields• Workflow will give you:

– Action buttons (workflow::case::get_available_actions)

– Role assignment (workflow::case::role::add_assignee_widgets )

– Case log ( workflow::case::get_activity_html )

• See packages/bug-tracker/www/bug.tcl

Page 18: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Integrating with your app’s queries

• For complex view-only listings, stats etc.

• Join with:– workflow_cases– workflow_fsm_states – And others…

• See the bug-tracker index-postgresql.xql for an example

Page 19: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Service Contracts and Callback goodness

• What is a callback good for?– Notifications– Other side effects

• What is a service contract?– ACS Service contract allows packages to define and register

implementation of interfaces– ACS Service contract provides mean to dispatch method

calls on an interface implementation. – Interface Discovery is available programmatically– The Service Contract interface specification was inspired by

WDSL, the interface specfication for web services.

Page 20: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

Package development details

• APM TCL callbacks:– after-install

(workflow::fsm::new_from_spec)– before-uninstall ( workflow::delete )– before-upgrade– after-instantiate ( workflow::fsm::clone )– before-uninstantiate( workflow::delete )

Page 21: Pumptheory.com Mark Aufflick OpenACS Workflow Mark Aufflick pumptheory.com.

pumptheory.comMark Aufflick

References

• All references, slides and materials will be posted on the internet at:

http://pumptheory.com/collaboration/open-acs/lectures/

• OpenACS Workflow documentation• http://www.collaboraid.biz/developer/workflow-spec