| 1 |
# |
| 2 |
# documentsignoffstate.pystate |
| 3 |
# |
| 4 |
# state machine model of the states and associated behaviors and properties for each |
| 5 |
# different state of a document in a document control system |
| 6 |
# |
| 7 |
# example using named state transitions |
| 8 |
|
| 9 |
# This implements a state model for submitting, |
| 10 |
# approving, activating, and purging document |
| 11 |
# revisions in a document management system. |
| 12 |
# |
| 13 |
# The state model looks like: |
| 14 |
# |
| 15 |
# New |
| 16 |
# | |
| 17 |
# | (create) |
| 18 |
# | |
| 19 |
# v |
| 20 |
# Editing ----------------------------------------------+ |
| 21 |
# | ^ | |
| 22 |
# | | | |
| 23 |
# | +----------+ | |
| 24 |
# | | | |
| 25 |
# | (submit) | | (cancel) |
| 26 |
# | | (reject) | |
| 27 |
# v | | |
| 28 |
# PendingApproval-+ | |
| 29 |
# | | |
| 30 |
# | (approve) | |
| 31 |
# | | |
| 32 |
# v | |
| 33 |
# Approved <--------------------------+ (deactivate) | |
| 34 |
# | | | | |
| 35 |
# | +--------------+ | | |
| 36 |
# | | (activate) | | |
| 37 |
# | v | | |
| 38 |
# | (retire) Active ----------+ | |
| 39 |
# | | |
| 40 |
# v | |
| 41 |
# Retired | |
| 42 |
# | | |
| 43 |
# | (purge) | |
| 44 |
# | | |
| 45 |
# v | |
| 46 |
# Deleted <---------------------------------------------+ |
| 47 |
# |
| 48 |
# |
| 49 |
# There is no behavior attached to these states, this is |
| 50 |
# just an example of a state machine with named transitions. |
| 51 |
# |
| 52 |
|
| 53 |
|
| 54 |
statemachine DocumentRevisionState: |
| 55 |
New -( create )-> Editing |
| 56 |
Editing -( cancel )-> Deleted |
| 57 |
Editing -( submit )-> PendingApproval |
| 58 |
PendingApproval -( reject )-> Editing |
| 59 |
PendingApproval -( approve )-> Approved |
| 60 |
Approved -( activate )-> Active |
| 61 |
Active -( deactivate )-> Approved |
| 62 |
Approved -( retire )-> Retired |
| 63 |
Retired -( purge )-> Deleted |
| 64 |
|
| 65 |
New.description = 'creating...' |
| 66 |
Editing.description = 'editing...' |
| 67 |
PendingApproval.description = 'reviewing...' |
| 68 |
Approved.description = 'approved/inactive...' |
| 69 |
Active.description = 'approved/active...' |
| 70 |
Deleted.description = 'deleted...' |
| 71 |
Retired.description = 'retired...' |