Announcement Announcement Module
Collapse
No announcement yet.
Transitions - Order of Precedence Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transitions - Order of Precedence

    In testing with SWF 2.0.5, I found that transitions are executed in the order that they are defined, with state transitions being evaluated prior to global transitions.

    Below are some example subflow states. In these examples, the subflow "sub-flow" always returns a value of "end".

    Example 1: Two state transitions, with the named transition defined prior to the wildcard (i.e. no "on" attribute) transition.

    <subflow-state id="start" subflow="sub-flow">
    <transition on="end" to="end" />
    <transition to="wildCardEnd" />
    </subflow-state>

    Result for Example 1: Transitions to "end".


    Example 2: Two state transitions, with the named transition defined after the wildcard transition.

    <subflow-state id="start" subflow="sub-flow">
    <transition to="wildCardEnd" />
    <transition on="end" to="end" />
    </subflow-state>

    Result for Example 2: Transitions to "wildCardEnd".


    Example 3: One global named transition and one state wildcard transition.

    <subflow-state id="start" subflow="sub-flow">
    <transition to="wildCardEnd" />
    </subflow-state>

    <global-transitions>
    <transition on="end" to="globalEnd" />
    </global-transitions>

    Result for Example 3: Transitions to "wildCardEnd".


    In my opinion, Example 1 and Example 2 should exhibit the same behavior. The order in which transitions are defined on a given state should not have any effect on the order of evaluation. Named transitions should take precedence over wildcard transitions.

    Example 3 also does not exhibit the behavior I expected. Given that global transitions are intended to support transitions for navigation bar links and other globally accessible navigation elements, a named global transition should take precedence over a wildcard state transition. In this way, states would still be able to take advantage of wildcard transitions while supporting global transitions. In addition, by always evaluating named transitions first, developers are prevented from inadvertently disabling global transitions through the use of a local wildcard transition.

    In summary, it appears that the current order of precedence for transitions is
    1. state transitions in order of definition
    2. global transitions in order of definition
    However, I suggest a more desirable order of precedence would be
    1. state transition with "on" attribute
    2. global transition with "on" attribute
    3. state transition without "on" attribute
    4. global transition without "on" attribute
    Is my evaluation of the current behavior correct? Is there a reason for the current behavior? If not, should this behavior be reported as an issue?
    Finally, is there any way under the current implementation to define a global transition with a specific “on” value that takes precedence over a wildcard state transition?

    Thanks in advance for the help,

    Noah
Working...
X