State Diagram “Sale State Diagram”
Requirements
This is an example of a state diagram that covers making a sale of n-many products.
Number:
3.1
Description:
The process of making a sale
Author:
Jon Kern
Priority:
low
Difficulty:
low
Note1:
NOTE: You can link State Diagrams to classes. See the diagram Property Inspector and look at "target class." For each transition, you can associate one of the class operations (action expression) -- not done here.
All Outgoing Links
Note Link
to Note Note1 (in Package Diagram Requirements)
Diagram Node Summary
Start
State
State
    Authorized
State
State
State
    Rejected
State
End
Diagram Node Detail
Start "Start"
All Outgoing Links
Transition
to State Checking Product
Guard Condition:
valid barcode

State "Cancelled"
All Outgoing Links
Transition
to End EndState1

State "Making Sale"
All Outgoing Links
Transition
to State Cancelled
Event Name:
cancelled
Nested Nodes
 Authorized,  Authorizing Payment,  Checking Product,  Rejected

State "Authorized"
Nested in node:
State Making Sale
All Outgoing Links
Transition
to End EndState1

State "Authorizing Payment"
Nested in node:
State Making Sale
All Outgoing Links
Transition
to State Authorized
Guard Condition:
credit OK
Transition
to State Rejected
Guard Condition:
credit BAD

State "Checking Product"
Nested in node:
State Making Sale
All Outgoing Links
Transition
to State Authorizing Payment
Guard Condition:
all items scanned
Transition
to State Checking Product
Event Name:
get next
Guard Condition:
has more

State "Rejected"
Nested in node:
State Making Sale

End "EndState1"