Adding a condition to a transition

A condition guards a transition, and will only allow movement to the next state when and if the condition evaluates to 'True'.

If an exception occurs while processing a condition, exception is ignored, and the condition for the next triggered transition, if any, is checked.

If a state defines more than one transition that uses the same triggering event, then all of those transitions must define guard conditions. More to the point, if a state defines an outbound, unguarded transition, then that state cannot have any other outbound transitions that use the same triggering event. If the triggering event is the completion event, then the state cannot have any other outbound transitions at all. The one exception to this rule is for composite states, which can both define a default transition and also define exception transitions.
Important: The visual or Java code should not change the value of variables. Any such changes will be ignored (the variables will have the same values before and after the condition is evaluated).
To add a condition to a transition, proceed as follows:
  1. On the canvas, select and hover over the transition that you want to modify.
  2. In the action bar that appears, click the condition icon as shown in this image.
    The condition element as it appears in the action bar.
  3. In the Properties area, click the Details tab.
  4. Select the Implementation. You have the following choices:
    Option Description
    Visual Choose this to use the visual snippet editor to graphically compose Java™ code.
    Java Choose this to write the Java code yourself.
    Invoke Choose this to invoke an operation on a reference that will return a boolean.
  5. If you would like to have the condition evaluate for 'False' instead of 'True', click the Invert result check box.
Your newly created condition will appear on the canvas on top of the transition that it is associated with.

Feedback
(C) Copyright IBM Corporation 2005, 2007. All Rights Reserved.