Skip to content

Instantly share code, notes, and snippets.

@cillianderoiste
Created August 20, 2015 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cillianderoiste/95c05550f3bc65c94abb to your computer and use it in GitHub Desktop.
Save cillianderoiste/95c05550f3bc65c94abb to your computer and use it in GitHub Desktop.
Plone Intranet Case Workflow definition with transition guards
<?xml version="1.0"?>
<dc-workflow workflow_id="synodalrat_case_workflow" title="Synodalrat Workflow" description="" state_variable="review_state" initial_state="new" manager_bypass="False" >
<permission>Modify portal content</permission>
<permission>View</permission>
<state state_id="archived" title="Archiviert" >
<description>The case is done and filed away.</description>
<exit-transition transition_id="back_to_closed" />
<group-map name="synodalrat_bearbeitende_einheit">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontopruefung">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontrolle">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_sekretariat">
<group-role>Reader</group-role>
</group-map>
</state>
<state state_id="closed" title="Abgeschlossen" >
<description>All handling of the case is complete, including payment, thank you letter, etc.</description>
<exit-transition transition_id="archive" />
<exit-transition transition_id="back_to_decided" />
<group-map name="synodalrat_bearbeitende_einheit">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontopruefung">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontrolle">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_sekretariat">
<group-role>Reader</group-role>
</group-map>
</state>
<state state_id="complete" title="Vollstaendig" >
<exit-transition transition_id="submit"/>
<exit-transition transition_id="back_to_in_progress"/>
<group-map name="synodalrat_bearbeitende_einheit">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontopruefung">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontrolle">
<group-role>Editor</group-role>
</group-map>
<group-map name="synodalrat_sekretariat">
<group-role>Reader</group-role>
</group-map>
</state>
<state state_id="decided" title="Beschlossen" >
<description>The decision has been made by the council.</description>
<exit-transition transition_id="close"/>
<exit-transition transition_id="back_to_request"/>
<group-map name="synodalrat_bearbeitende_einheit">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontopruefung">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontrolle">
<group-role>Editor</group-role>
</group-map>
<group-map name="synodalrat_sekretariat">
<group-role>Reader</group-role>
</group-map>
</state>
<state state_id="in_progress" title="In Bearbeitung" >
<description>Gathering of basic data is complete. The case is handled by the responsible department.</description>
<exit-transition transition_id="finalise"/>
<exit-transition transition_id="reject"/>
<exit-transition transition_id="back_to_new"/>
<group-map name="synodalrat_bearbeitende_einheit">
<group-role>Editor</group-role>
</group-map>
<group-map name="synodalrat_kontopruefung">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontrolle">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_sekretariat">
<group-role>Reader</group-role>
</group-map>
</state>
<state state_id="new" title="Neu" >
<description>Basic data is being gathered and added to the case.</description>
<exit-transition transition_id="transfer_to_department"/>
<exit-transition transition_id="reject"/>
<group-map name="synodalrat_sekretariat">
<group-role>Editor</group-role>
</group-map>
</state>
<state state_id="rejected" title="Rejected Before Decision" >
<description>The case has been rejected before an official decision was made and is not treated any further.</description>
</state>
<state state_id="request" title="Antrag" >
<description>The case is ready for a decision by the council.</description>
<exit-transition transition_id="reject"/>
<exit-transition transition_id="rework"/>
<exit-transition transition_id="decide"/>
<exit-transition transition_id="back_to_complete"/>
<group-map name="synodalrat_bearbeitende_einheit">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontopruefung">
<group-role>Reader</group-role>
</group-map>
<group-map name="synodalrat_kontrolle">
<group-role>Editor</group-role>
</group-map>
<group-map name="synodalrat_sekretariat">
<group-role>Reader</group-role>
</group-map>
</state>
<transition transition_id="archive" title="Archive" new_state="archived" trigger="USER" before_script="" after_script="" >
<description>Mark the case as done and file away.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=archive" category="workflow" icon="">Archive</action>
<guard >
<guard-expression>here/case_workflow_guard</guard-expression>
</guard>
</transition>
<transition transition_id="close" title="Close" new_state="closed" trigger="USER" before_script="" after_script="" >
<description>Close the case.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=close" category="workflow" icon="">Close</action>
<guard >
<guard-expression>here/case_workflow_guard</guard-expression>
</guard>
</transition>
<transition transition_id="back_to_closed" title="Back_To_Closed" new_state="closed" trigger="USER" before_script="" after_script="" >
<description>Back_To_Closed the case.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=back_to_closed" category="workflow" icon="">Back_To_Closed</action>
<guard />
</transition>
<transition transition_id="decide" title="Decide" new_state="decided" trigger="USER" before_script="" after_script="" >
<description>Accept or deny the case.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=decide" category="workflow" icon="">Decide</action>
<guard >
<guard-expression>here/case_workflow_guard</guard-expression>
</guard>
</transition>
<transition transition_id="back_to_decided" title="Back_To_Decided" new_state="decided" trigger="USER" before_script="" after_script="" >
<description>Accept or deny the case.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=back_to_decided" category="workflow" icon="">Back_To_Decided</action>
<guard />
</transition>
<transition transition_id="finalise" title="Finalise" new_state="complete" trigger="USER" before_script="" after_script="" >
<description>Finish handling by the department and mark as ready for verification.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=finalise" category="workflow" icon="">Finalise</action>
<guard >
<guard-expression>here/case_workflow_guard</guard-expression>
</guard>
</transition>
<transition transition_id="back_to_complete" title="Back_To_Complete" new_state="complete" trigger="USER" before_script="" after_script="" >
<description>Finish handling by the department and mark as ready for verification.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=back_to_complete" category="workflow" icon="">Back_To_Complete</action>
<guard />
</transition>
<transition transition_id="reject" title="Reject" new_state="rejected" trigger="USER" before_script="" after_script="" >
<description>Reject the case before any official decision is made.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=reject" category="workflow" icon="">Reject</action>
<guard >
<guard-expression>here/case_workflow_guard</guard-expression>
</guard>
</transition>
<transition transition_id="back_to_new" title="Reset" new_state="new" trigger="USER" before_script="" after_script="" >
<description>Reset to the initial state.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=back_to_new" category="workflow" icon="">Reset</action>
<guard />
</transition>
<transition transition_id="rework" title="Rework" new_state="in_progress" trigger="USER" before_script="" after_script="" >
<description>Rework the case and then re-submit.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=rework" category="workflow" icon="">Rework</action>
<guard >
<guard-expression>here/case_workflow_guard</guard-expression>
</guard>
</transition>
<transition transition_id="submit" title="Submit" new_state="request" trigger="USER" before_script="" after_script="" >
<description>Submit the case for decision by the council.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=submit" category="workflow" icon="">Submit</action>
<guard >
<guard-expression>here/case_workflow_guard</guard-expression>
</guard>
</transition>
<transition transition_id="back_to_request" title="Back_To_Request" new_state="request" trigger="USER" before_script="" after_script="" >
<description>Back_To_Request the case for decision by the council.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=back_to_request" category="workflow" icon="">Back_To_Request</action>
<guard />
</transition>
<transition transition_id="transfer_to_department" title="Transfer To Department" new_state="in_progress" trigger="USER" before_script="" after_script="" >
<description>Transfer the case to the responsible department.</description>
<action url="%(content_url)s/content_status_modify?workflow_action=transfer_to_department" category="workflow" icon="">Transfer To Department</action>
<guard >
<guard-expression>here/case_workflow_guard</guard-expression>
</guard>
</transition>
<transition transition_id="back_to_in_progress" title="Back To In Progress" new_state="in_progress" trigger="USER" before_script="" after_script="" >
<description>Back To In Progress</description>
<action url="%(content_url)s/content_status_modify?workflow_action=back_to_in_progress" category="workflow" icon="">Back To In Progress</action>
<guard />
</transition>
<variable variable_id="action" for_catalog="False" for_status="True" update_always="True" >
<description>Previous transition</description>
<default>
<expression>transition/getId|nothing</expression>
</default>
<guard >
</guard>
</variable>
<variable variable_id="actor" for_catalog="False" for_status="True" update_always="True" >
<description>The ID of the user who performed the previous transition</description>
<default>
<expression>user/getId</expression>
</default>
<guard >
</guard>
</variable>
<variable variable_id="comments" for_catalog="False" for_status="True" update_always="True" >
<description>Comment about the last transition</description>
<default>
<expression>python:state_change.kwargs.get('comment', '')</expression>
</default>
<guard >
</guard>
</variable>
<variable variable_id="metromap_transitions" for_catalog="False" for_status="True" update_always="True" >
<description>A list of dicts which order the workflow states along with the next transition in the sequence, used for the metromap</description>
<default>
<expression>python:[
{'state': 'new', 'next_transition': 'transfer_to_department', 'reopen_transition': 'back_to_new'},
{'state': 'in_progress', 'next_transition':'finalise', 'reopen_transition': 'back_to_in_progress'},
{'state': 'complete', 'next_transition': 'submit', 'reopen_transition': 'back_to_complete'},
{'state': 'request', 'next_transition': 'decide', 'reopen_transition': 'back_to_request'},
{'state': 'decided', 'next_transition': 'close', 'reopen_transition': 'back_to_decided'},
{'state': 'closed', 'next_transition': 'archive', 'reopen_transition': 'back_to_closed'},
{'state': 'archived'}
]</expression>
</default>
<guard >
</guard>
</variable>
<variable variable_id="review_history" for_catalog="False" for_status="False" update_always="False" >
<description>Provides access to workflow history</description>
<default>
<expression>state_change/getHistory</expression>
</default>
<guard >
<guard-permission>Request review</guard-permission>
<guard-permission>Review portal content</guard-permission>
</guard>
</variable>
<variable variable_id="time" for_catalog="False" for_status="True" update_always="True" >
<description>When the previous transition was performed</description>
<default>
<expression>state_change/getDateTime</expression>
</default>
<guard >
</guard>
</variable>
</dc-workflow>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment