Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.springframework.webflow
Class ActionState  view ActionState download ActionState.java

java.lang.Object
  extended byorg.springframework.webflow.AnnotatedObject
      extended byorg.springframework.webflow.State
          extended byorg.springframework.webflow.TransitionableState
              extended byorg.springframework.webflow.ActionState

public class ActionState
extends TransitionableState

A transitionable state that executes one or more actions when entered. When the action(s) are executed, this state responds to their result(s) to decide where to go next.

If more than one action is configured, they are executed in an ordered chain until one returns a result event that matches a valid state transition out of this state. This is a form of the Chain of Responsibility (CoR) pattern.

The result of an action's execution is treated as a contributing criterion for a state transition. In addition, anything else in the Flow's RequestContext may be tested as part of custom transitional criteria, allowing for sophisticated transition expressions that reason on contextual state.

Each action executed by this action state may be provisioned with a set of arbitrary properties. These properties are made available to the action at execution time.

Common action execution properties include:

PropertyDescription
Name The 'name' property is used as a qualifier for the action's result event. For example, if an action named myAction returns a success result, a transition for event myAction.success will be searched, and if found, executed. If the action is not named a transition for the base success event will be searched and if found, executed.
This is useful in situations where you want to execute actions in an ordered chain as part of one action state, and wish to transition on the result of the last one in the chain. For example:
 <action-state id="setupForm"> 
     <action name="setup" bean="myAction" method="setupForm"/> 
     <action name="referenceData" bean="myAction" method="setupReferenceData"/> 
     <transition on="referenceData.success" to="displayForm"/> 
 </action-state>
 
The above will trigger the execution of the 'setup' action followed by the 'referenceData' action. The flow will then respond to the referenceData 'success' event by transitioning to 'displayForm'.
Method The 'method' property is the name of the method on a org.springframework.webflow.action.MultiAction implementation to call when this action is executed. The named method must have the signature public Event ${method}(RequestContext), for example a method property with value setupForm would bind to a method on the MultiAction with the signature: public Event setupForm(RequestContext context).


Field Summary
private  java.util.Set actionExecutors
          The set of actions to be executed when this action state is entered.
 
Fields inherited from class org.springframework.webflow.TransitionableState
 
Fields inherited from class org.springframework.webflow.State
logger
 
Fields inherited from class org.springframework.webflow.AnnotatedObject
 
Constructor Summary
ActionState()
          Default constructor for bean style usage.
ActionState(Flow flow, java.lang.String id, Action[] actions, Transition transition)
          Create a new action state.
ActionState(Flow flow, java.lang.String id, Action[] actions, Transition[] transitions)
          Create a new action state.
ActionState(Flow flow, java.lang.String id, Action[] actions, Transition[] transitions, java.util.Map properties)
          Create a new action state.
ActionState(Flow flow, java.lang.String id, Action action, Transition transition)
          Create a new action state.
ActionState(Flow flow, java.lang.String id, Action action, Transition[] transitions)
          Create a new action state.
ActionState(Flow flow, java.lang.String id, Action action, Transition[] transitions, java.util.Map properties)
          Create a new action state.
 
Method Summary
private  java.util.Iterator actionExecutors()
          Returns an iterator that lists the set of actions to execute for this state.
 void addAction(Action action)
          Add a target action instance to this state.
 void addActions(Action[] actions)
          Add a collection of target action instances to this state.
protected  void createToString(ToStringCreator creator)
          Subclasses may override this hook method to stringify their internal state.
protected  ViewDescriptor doEnter(StateContext context)
          Specialization of State's doEnter template method that executes behaviour specific to this state type in polymorphic fashion.
 Action getAction()
          Returns the first action executed by this action state.
 int getActionCount()
          Returns the number of actions executed by this action state when it is entered.
 Action[] getActions()
          Returns the list of actions executed by this action state.
 AnnotatedAction getAnnotatedAction()
          Returns the first action executed by this action state with its annotations
 AnnotatedAction[] getAnnotatedActions()
          Returns the list of actions executed by this action state with annotations.
 
Methods inherited from class org.springframework.webflow.TransitionableState
add, addAll, exit, getExitAction, getRequiredTransition, getTransition, getTransitionCriterias, getTransitions, hasTransitionFor, onEvent, reenter, setExitAction, transitionsIterator
 
Methods inherited from class org.springframework.webflow.State
enter, executeEntryAction, getEntryAction, getFlow, getId, isTransitionable, setEntryAction, setFlow, setId, toString
 
Methods inherited from class org.springframework.webflow.AnnotatedObject
containsAttribute, containsProperty, getAttribute, getProperties, getProperty, setAttribute, setProperties, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actionExecutors

private java.util.Set actionExecutors
The set of actions to be executed when this action state is entered.

Constructor Detail

ActionState

public ActionState()
Default constructor for bean style usage.


ActionState

public ActionState(Flow flow,
                   java.lang.String id,
                   Action action,
                   Transition transition)
            throws java.lang.IllegalArgumentException
Create a new action state.


ActionState

public ActionState(Flow flow,
                   java.lang.String id,
                   Action action,
                   Transition[] transitions)
            throws java.lang.IllegalArgumentException
Create a new action state.


ActionState

public ActionState(Flow flow,
                   java.lang.String id,
                   Action action,
                   Transition[] transitions,
                   java.util.Map properties)
            throws java.lang.IllegalArgumentException
Create a new action state.


ActionState

public ActionState(Flow flow,
                   java.lang.String id,
                   Action[] actions,
                   Transition transition)
            throws java.lang.IllegalArgumentException
Create a new action state.


ActionState

public ActionState(Flow flow,
                   java.lang.String id,
                   Action[] actions,
                   Transition[] transitions)
            throws java.lang.IllegalArgumentException
Create a new action state.


ActionState

public ActionState(Flow flow,
                   java.lang.String id,
                   Action[] actions,
                   Transition[] transitions,
                   java.util.Map properties)
            throws java.lang.IllegalArgumentException
Create a new action state.

Method Detail

addAction

public void addAction(Action action)
Add a target action instance to this state.


addActions

public void addActions(Action[] actions)
Add a collection of target action instances to this state.


actionExecutors

private java.util.Iterator actionExecutors()
Returns an iterator that lists the set of actions to execute for this state. Returns a iterator over a collection of ActionExecutor objects.


getActionCount

public int getActionCount()
Returns the number of actions executed by this action state when it is entered.


getAction

public Action getAction()
Returns the first action executed by this action state.


getAnnotatedAction

public AnnotatedAction getAnnotatedAction()
Returns the first action executed by this action state with its annotations


getActions

public Action[] getActions()
Returns the list of actions executed by this action state.


getAnnotatedActions

public AnnotatedAction[] getAnnotatedActions()
Returns the list of actions executed by this action state with annotations.


doEnter

protected ViewDescriptor doEnter(StateContext context)
Specialization of State's doEnter template method that executes behaviour specific to this state type in polymorphic fashion.

This implementation iterates over each configured Action instance and executes it. Execution continues until an Action returns a result event that matches a state transition in this request context, or the set of all actions is exhausted.

Specified by:
doEnter in class State

createToString

protected void createToString(ToStringCreator creator)
Description copied from class: State
Subclasses may override this hook method to stringify their internal state. This default implementation does nothing.

Overrides:
createToString in class TransitionableState