What is a superstate ? a Superstate is a group of nodes.
Superstates are a convenient way to group nodes into related sets, denoting for instance phases in a process. For example, one application could be to group all the nodes of a process in phases. Actions can be associated with superstate events. A consequence is that a token can be in multiple nested nodes at a given time. This can be convenient to check wether a process execution is e.g. in the start-up phase.
All transitions leaving a superstate can be taken by tokens in nodes contained within the super state. Transitions can also arrive in superstates. In that case, the token will be redirected to the first node in the superstate. Nodes from outside the superstate can have transitions directly to nodes inside the superstate. Also, the other way round, nodes within superstates can have transitions to nodes outside the superstate or to the superstate itself. Superstates also can have self references
jBPM superstate events
There are 2 events unique to superstates: superstate-enter and superstate-leave. These events will be fired no matter over which transitions the node is entered or left respectively. As long as a token takes transitions within the superstate, these events are not fired.
Note that we have created separate event types for states and superstates. This is to make it easy to distinct between superstate events and node events that are propagated from within the superstate
Node names have to be unique in their scope. The scope of the node is its node-collection. Both the process definintion and the superstate are node collections.
To refer to nodes in superstates, you have to specify the relative, slash (/) separated name. The slash separates the node names. Use ‘..’ to refer to an upper level. The next example shows how to reference a neighbouring superstate.
In this sample a node points directly to a node inside the superstate: however a transition can point just to a super state.When a transition arrive to a superstate and the node is not specified then the token is redirected to the first node without an incoming transition.