Spring Web Flow

org.springframework.webflow.engine
Class TransitionableState

java.lang.Object
  extended by org.springframework.webflow.core.AnnotatedObject
      extended by org.springframework.webflow.engine.State
          extended by org.springframework.webflow.engine.TransitionableState
All Implemented Interfaces:
Annotated, StateDefinition, TransitionableStateDefinition
Direct Known Subclasses:
ActionState, DecisionState, SubflowState, ViewState

public abstract class TransitionableState
extends State
implements TransitionableStateDefinition

Abstract superclass for states that can execute a transition in response to an event.

Author:
Keith Donald, Erwin Vervaet
See Also:
Transition, TransitionCriteria

Field Summary
 
Fields inherited from class org.springframework.webflow.engine.State
logger
 
Fields inherited from class org.springframework.webflow.core.AnnotatedObject
CAPTION_PROPERTY, DESCRIPTION_PROPERTY
 
Constructor Summary
protected TransitionableState(Flow flow, java.lang.String id)
          Create a new transitionable state.
 
Method Summary
protected  void appendToString(org.springframework.core.style.ToStringCreator creator)
          Subclasses may override this hook method to print their internal state to a string.
 void exit(RequestControlContext context)
          Exit this state.
 ActionList getExitActionList()
          Returns the list of actions executed by this state when it is exited.
 Transition getRequiredTransition(RequestContext context)
          Get a transition in this state for given flow execution request context.
 TransitionDefinition getTransition(java.lang.String eventId)
          Returns the transition that matches the event with the provided id.
 TransitionDefinition[] getTransitions()
          Returns the available transitions out of this state.
 TransitionSet getTransitionSet()
          Returns the set of transitions.
 boolean handleEvent(RequestControlContext context)
          Inform this state definition that an event was signaled in it.
 
Methods inherited from class org.springframework.webflow.engine.State
doEnter, doPreEntryActions, enter, equals, getEntryActionList, getExceptionHandlerSet, getFlow, getId, getOwner, handleException, hashCode, isStartState, isViewState, toString
 
Methods inherited from class org.springframework.webflow.core.AnnotatedObject
getAttributes, getCaption, getDescription, setCaption, setDescription
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.webflow.definition.StateDefinition
getId, getOwner, isViewState
 
Methods inherited from interface org.springframework.webflow.core.Annotated
getAttributes, getCaption, getDescription
 

Constructor Detail

TransitionableState

protected TransitionableState(Flow flow,
                              java.lang.String id)
                       throws java.lang.IllegalArgumentException
Create a new transitionable state.

Parameters:
flow - the owning flow
id - the state identifier (must be unique to the flow)
Throws:
java.lang.IllegalArgumentException - when this state cannot be added to given flow, for instance when the id is not unique
See Also:
State.State(Flow, String), getTransitionSet()
Method Detail

getTransitions

public TransitionDefinition[] getTransitions()
Description copied from interface: TransitionableStateDefinition
Returns the available transitions out of this state.

Specified by:
getTransitions in interface TransitionableStateDefinition
Returns:
the available state transitions

getTransition

public TransitionDefinition getTransition(java.lang.String eventId)
Description copied from interface: TransitionableStateDefinition
Returns the transition that matches the event with the provided id.

Specified by:
getTransition in interface TransitionableStateDefinition
Parameters:
eventId - the event id
Returns:
the transition that matches, or null if no match is found.

getTransitionSet

public TransitionSet getTransitionSet()
Returns the set of transitions. The returned set is mutable.


getRequiredTransition

public Transition getRequiredTransition(RequestContext context)
                                 throws NoMatchingTransitionException
Get a transition in this state for given flow execution request context. Throws and exception when there is no corresponding transition.

Throws:
NoMatchingTransitionException - when a matching transition cannot be found

getExitActionList

public ActionList getExitActionList()
Returns the list of actions executed by this state when it is exited. The returned list is mutable.

Returns:
the state exit action list

handleEvent

public boolean handleEvent(RequestControlContext context)
                    throws NoMatchingTransitionException
Inform this state definition that an event was signaled in it. The signaled event is the last event available in given request context (RequestContext.getCurrentEvent()).

Parameters:
context - the flow execution control context
Throws:
NoMatchingTransitionException - when a matching transition cannot be found

exit

public void exit(RequestControlContext context)
Exit this state. This is typically called when a transition takes the flow out of this state into another state. By default just executes any registered exit actions.

Parameters:
context - the flow control context

appendToString

protected void appendToString(org.springframework.core.style.ToStringCreator creator)
Description copied from class: State
Subclasses may override this hook method to print their internal state to a string. This default implementation does nothing.

Overrides:
appendToString in class State
Parameters:
creator - the toString creator, to print properties to string
See Also:
State.toString()

Spring Web Flow