public class ActionState extends TransitionableState
If more than one action is configured they are executed in an ordered chain until one returns a result event that matches a 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 typically the criteria for a transition out of this state. Additional
information in the current RequestContext
may also be tested as part of custom transitional criteria,
allowing for sophisticated transition expressions that reason on contextual state.
Action
CAPTION_PROPERTY, DESCRIPTION_PROPERTY
Constructor and Description |
---|
ActionState(Flow flow,
java.lang.String id)
Creates a new action state.
|
Modifier and Type | Method and Description |
---|---|
protected void |
appendToString(org.springframework.core.style.ToStringCreator creator)
Subclasses may override this hook method to print their internal state to a string.
|
protected void |
doEnter(RequestControlContext context)
Specialization of State's
doEnter template method that executes behavior specific to this state
type in polymorphic fashion. |
ActionList |
getActionList()
Returns the list of actions executable by this action state.
|
Transition |
getRequiredTransition(RequestContext context)
Get a transition in this state for given flow execution request context.
|
exit, getExitActionList, getTransition, getTransitions, getTransitionSet, handleEvent
doPreEntryActions, enter, equals, getEntryActionList, getExceptionHandlerSet, getFlow, getId, getOwner, handleException, hashCode, isStartState, isViewState, toString
getAttributes, getCaption, getDescription, setCaption, setDescription
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getOwner, isViewState
getAttributes, getCaption, getDescription
public ActionState(Flow flow, java.lang.String id) throws java.lang.IllegalArgumentException
flow
- the owning flowid
- the state identifier (must be unique to the flow)java.lang.IllegalArgumentException
- when this state cannot be added to given flow, e.g. beasue the id is not uniquegetActionList()
public ActionList getActionList()
public Transition getRequiredTransition(RequestContext context) throws NoMatchingTransitionException
TransitionableState
getRequiredTransition
in class TransitionableState
NoMatchingTransitionException
- when a matching transition cannot be foundprotected void doEnter(RequestControlContext context) throws FlowExecutionException
doEnter
template method that executes behavior 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 transition in this request
context, or the set of all actions is exhausted.
doEnter
in class State
context
- the control context for the currently executing flow, used by this state to manipulate the flow
executionFlowExecutionException
- if an exception occurs in this stateprotected void appendToString(org.springframework.core.style.ToStringCreator creator)
State
appendToString
in class TransitionableState
creator
- the toString creator, to print properties to stringState.toString()