Take a look at https://github.com/steelbreeze/state - this provides a hierarchical state machine based loosely on UML 2 semantics (using 'completion transitions' between states you can achieve workflow-like behaviour).

There's more examples at https://steelbreeze.net/state/