Skip to content

Example 5: An order

Nikolaos Pougounias edited this page Jul 29, 2014 · 4 revisions

In this more complex example we would like to monitor an Order.

The state diagram of an Order

The state diagram consists of the following elements:

States

  • STATE_CANCELLED
  • STATE_PROCESSING
  • STATE_SHIPPED

Events

  • EVENT_CANCEL
  • EVENT_PROCESS
  • EVENT_SHIP

Transitions

  • A: from STATE_PENDING to STATE_CANCELLED
  • B: from STATE_PROCESSING to STATE_CANCELLED
  • C: from STATE_PENDING to STATE_PROCESSING
  • D: from STATE_PROCESSING to STATE_SHIPPED

The complete declaration is under conf/context-example5.xml.

Run src/test/java/gr.ekt.fsmengine.example5.Run to see the execution flow.

An order that was immediately cancelled:

An order that was immediately cancelled

A pending order that was finally cancelled:

A pending order that was finally cancelled

An order that was shipped:

An order that was shipped

Clone this wiki locally