org.springframework.webflow.engine
Class EndState

java.lang.Object
  extended by org.springframework.webflow.engine.AnnotatedObject
      extended by org.springframework.webflow.engine.State
          extended by org.springframework.webflow.engine.EndState
All Implemented Interfaces:
Annotated, StateDefinition

public class EndState
extends State

A state that ends a flow when entered. More specifically, this state ends the active flow session of the active flow execution associated with the current request context.

If the ended session is the "root flow session" the entire flow execution ends, signaling the end of a logical conversation.

If the terminated session was acting as a subflow the flow execution continues and control is returned to the parent flow session. In that case, this state returns an ending result event the resuming parent flow is expected to respond to.

An end state may optionally be configured with the name of a view to render when entered. This view will be rendered if the end state terminates the entire flow execution as a kind of flow ending "confirmation page".

Note: if no viewName property is specified and this end state terminates the entire flow execution it is expected that some action has already written the response (or else a blank response will result). On the other hand, if no viewName is specified and this end state relinquishes control back to a parent flow, view selection responsibility falls on the parent flow.

Author:
Keith Donald, Colin Sampaleanu, Erwin Vervaet
See Also:
ViewSelector, SubflowState

Field Summary
 
Fields inherited from class org.springframework.webflow.engine.State
logger
 
Fields inherited from class org.springframework.webflow.engine.AnnotatedObject
CAPTION_PROPERTY, DESCRIPTION_PROPERTY
 
Constructor Summary
EndState(Flow flow, java.lang.String id)
          Create a new end state with no associated view.
 
Method Summary
protected  void appendToString(org.springframework.core.style.ToStringCreator creator)
          Subclasses may override this hook method to stringify their internal state.
protected  LocalAttributeMap createSessionOutput(RequestContext context)
          Returns the subflow output map.
protected  ViewSelection doEnter(RequestControlContext context)
          Specialization of State's doEnter template method that executes behaviour specific to this state type in polymorphic fashion.
 org.springframework.binding.mapping.AttributeMapper getOutputMapper()
          Returns the configured attribute mapper for mapping output attributes exposed by this end state when it is entered.
 ViewSelector getViewSelector()
          Returns the strategy used to select the view to render in this end state if it terminates a root flow.
 void setOutputMapper(org.springframework.binding.mapping.AttributeMapper outputMapper)
          Sets the attribute mapper to use for mapping output attributes exposed by this end state when it is entered.
 void setViewSelector(ViewSelector viewSelector)
          Sets the strategy used to select the view to render when this end state is entered and terminates a root flow.
 
Methods inherited from class org.springframework.webflow.engine.State
enter, equals, getEntryActionList, getExceptionHandlerSet, getFlow, getId, getOwner, handleException, hashCode, isStartState, toString
 
Methods inherited from class org.springframework.webflow.engine.AnnotatedObject
getAttributeMap, 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.Annotated
getAttributes, getCaption, getDescription
 

Constructor Detail

EndState

public EndState(Flow flow,
                java.lang.String id)
         throws java.lang.IllegalArgumentException
Create a new end state with no associated view.

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, e.g. because the id is not unique
See Also:
State.State(Flow, String), setViewSelector(ViewSelector), setOutputMapper(AttributeMapper)
Method Detail

getViewSelector

public ViewSelector getViewSelector()
Returns the strategy used to select the view to render in this end state if it terminates a root flow.


setViewSelector

public void setViewSelector(ViewSelector viewSelector)
Sets the strategy used to select the view to render when this end state is entered and terminates a root flow.


getOutputMapper

public org.springframework.binding.mapping.AttributeMapper getOutputMapper()
Returns the configured attribute mapper for mapping output attributes exposed by this end state when it is entered.


setOutputMapper

public void setOutputMapper(org.springframework.binding.mapping.AttributeMapper outputMapper)
Sets the attribute mapper to use for mapping output attributes exposed by this end state when it is entered.


doEnter

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

This implementation pops the top (active) flow session off the execution stack, ending it, and resumes control in the parent flow (if neccessary). If the ended session is the root flow, a ViewSelection is returned.

Specified by:
doEnter in class State
Parameters:
context - the control context for the currently executing flow, used by this state to manipulate the flow execution
Returns:
a view selection signaling that control should be returned to the client and a view rendered
Throws:
FlowExecutionException - if an exception occurs in this state

createSessionOutput

protected LocalAttributeMap createSessionOutput(RequestContext context)
Returns the subflow output map. This will invoke the output mapper (if any) to map data available in the flow execution request context into a newly created empty map.


appendToString

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

Overrides:
appendToString in class State
Parameters:
creator - the toString creator, to stringify properties


Copyright © 2004-2007. All Rights Reserved.