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.

Superstate transitions
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

jboss jbpm

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

Hierarchical names
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.

jbpm tutorialTo 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.




<fork name="fork1">


<transition to="Send Mail" name="to Send Mail"></transition>


<transition to="super-state1/Check Money"></transition>



<join name = "join1" />

super-state name="super-state1">


<state name="Check Money">


<transition to="Check Identity"></transition>




<state name="Check Identity">


<transition to="../join1"></transition>





In this sample a node points directly to a node inside the superstate: however a transition can point just to a super state.

jbpm tutorialWhen 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.




Related articles available on mastertheboss.com

JBPM tutorial

JBoss jBPM 3 is a flexible, extensible framework for process lang

How do I fire an action every time a JBPM Node enters?

JBoss recipe of the day

Jbpm Mail delivery

Almost every workflow needs a notification of the process activit

How do you embed Java code in your JPDL ?

  You can use a BeanShell expression to add a Java script in you

JBPM best practices

There's no perfect rule to model your workflow, it depends on the

How to delete/persist your JBPM process after restart ?

JBoss recipe of the day