5.4. Action outcome event mappings

Actions often invoke methods on plain Java objects. When called from action-states and decision-states, these method return values can be used to drive state transitions. Since transitions are triggered by events, a method return value must first be mapped to an Event object. The following table describes how common return value types are mapped to Event objects:

Table 5.1. Action method return value to event id mappings

Method return typeMapped Event identifier expression
java.lang.Stringthe String value
java.lang.Booleanyes (for true), no (for false)
java.lang.Enumthe Enum name
any other typesuccess

This is illustrated in the example action state below, which invokes a method that returns a boolean value:

<action-state id="moreAnswersNeeded">
    <evaluate expression="interview.moreAnswersNeeded()" />
    <transition on="yes" to="answerQuestions" />
    <transition on="no" to="finish" />
</action-state>