org.springframework.webflow.engine.builder
Class AbstractFlowBuilder

java.lang.Object
  extended by org.springframework.webflow.engine.builder.BaseFlowBuilder
      extended by org.springframework.webflow.engine.builder.AbstractFlowBuilder
All Implemented Interfaces:
FlowBuilder

public abstract class AbstractFlowBuilder
extends BaseFlowBuilder

Base class for flow builders that programmatically build flows in Java configuration code.

To give you an example of what a simple Java-based web flow builder definition might look like, the following example defines the 'dynamic' web flow roughly equivalent to the work flow statically implemented in Spring MVC's simple form controller:

 public class CustomerDetailFlowBuilder extends AbstractFlowBuilder {
        public void buildStates() {
                // get customer information
                addActionState("getDetails", action("customerAction"), transition(on(success()), to("displayDetails")));
 
                // view customer information               
                addViewState("displayDetails", "customerDetails", transition(on(submit()), to("bindAndValidate")));
 
                // bind and validate customer information updates 
                addActionState("bindAndValidate", action("customerAction"), new Transition[] {
                                transition(on(error()), to("displayDetails")), transition(on(success()), to("finish")) });
 
                // finish
                addEndState("finish");
        }
 }
 
What this Java-based FlowBuilder implementation does is add four states to a flow. These include a "get" ActionState (the start state), a ViewState state, a "bind and validate" ActionState, and an end marker state (EndState).

The first state, an action state, will be assigned the indentifier getDetails. This action state will automatically be configured with the following defaults:

  1. The action instance with id customerAction. This is the Action implementation that will execute when this state is entered. In this example, that Action will go out to the DB, load the Customer, and put it in the Flow's request context.
  2. A success transition to a default view state, called displayDetails. This means when the Action returns a success result event (aka outcome), the displayDetails state will be entered.
  3. It will act as the start state for this flow (by default, the first state added to a flow during the build process is treated as the start state).

The second state, a view state, will be identified as displayDetails. This view state will automatically be configured with the following defaults:

  1. A view name called customerDetails. This is the logical name of a view resource. This logical view name gets mapped to a physical view resource (jsp, etc.) by the calling front controller (via a Spring view resolver, or a Struts action forward, for example).
  2. A submit transition to a bind and validate action state, indentified by the default id bindAndValidate. This means when a submit event is signaled by the view (for example, on a submit button click), the bindAndValidate action state will be entered and the bindAndValidate method of the customerAction Action implementation will be executed.

The third state, an action state, will be indentified as bindAndValidate. This action state will automatically be configured with the following defaults:

  1. An action bean named customerAction -- this is the name of the Action implementation exported in the application context that will execute when this state is entered. In this example, the Action has a "bindAndValidate" method that will bind form input in the HTTP request to a backing Customer form object, validate it, and update the DB.
  2. A success transition to a default end state, called finish. This means if the Action returns a success result, the finish end state will be transitioned to and the flow will terminate.
  3. An error transition back to the form view. This means if the Action returns an error event, the displayDetails view state will be transitioned back to.

The fourth and last state, an end state, will be indentified with the default end state id finish. This end state is a marker that signals the end of the flow. When entered, the flow session terminates, and if this flow is acting as a root flow in the current flow execution, any flow-allocated resources will be cleaned up. An end state can optionally be configured with a logical view name to forward to when entered. It will also trigger a state transition in a resuming parent flow if this flow was participating as a spawned 'subflow' within a suspended parent flow.

Author:
Keith Donald, Erwin Vervaet

Constructor Summary
protected AbstractFlowBuilder()
          Default constructor for subclassing.
protected AbstractFlowBuilder(FlowServiceLocator flowServiceLocator)
          Create an instance of an abstract flow builder, using the specified locator to obtain needed flow services at build time.
 
Method Summary
protected  Action action(org.springframework.binding.expression.Expression expression)
          Creates an evaluate action that evaluates the expression when executed.
protected  Action action(org.springframework.binding.expression.Expression expression, ActionResultExposer resultExposer)
          Creates an evaluate action that evaluates the expression when executed.
protected  Action action(java.lang.String id)
          Resolves the action with the specified id.
protected  Action action(java.lang.String beanId, org.springframework.binding.method.MethodSignature methodSignature)
          Creates a bean invoking action that invokes the method identified by the signature on the bean associated with the action identifier.
protected  Action action(java.lang.String beanId, org.springframework.binding.method.MethodSignature methodSignature, ActionResultExposer resultExposer)
          Creates a bean invoking action that invokes the method identified by the signature on the bean associated with the action identifier.
protected  java.lang.String add()
          Creates the add event id.
protected  State addActionState(java.lang.String stateId, Action[] entryActions, Action[] actions, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap attributes)
          Adds an action state to the flow built by this builder.
protected  State addActionState(java.lang.String stateId, Action action, Transition transition)
          Adds an action state to the flow built by this builder.
protected  State addActionState(java.lang.String stateId, Action action, Transition[] transitions)
          Adds an action state to the flow built by this builder.
protected  State addActionState(java.lang.String stateId, Action action, Transition transition, FlowExecutionExceptionHandler exceptionHandler)
          Adds an action state to the flow built by this builder.
protected  State addDecisionState(java.lang.String stateId, Action[] entryActions, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap attributes)
          Adds a decision state to the flow built by this builder.
protected  State addDecisionState(java.lang.String stateId, Transition[] transitions)
          Adds a decision state to the flow built by this builder.
protected  State addDecisionState(java.lang.String stateId, TransitionCriteria decisionCriteria, java.lang.String trueStateId, java.lang.String falseStateId)
          Adds a decision state to the flow built by this builder.
protected  State addEndState(java.lang.String stateId)
          Adds an end state to the flow built by this builder.
protected  State addEndState(java.lang.String stateId, Action[] entryActions, ViewSelector viewSelector, org.springframework.binding.mapping.AttributeMapper outputMapper, FlowExecutionExceptionHandler[] exceptionHandlers, AttributeMap attributes)
          Adds an end state to the flow built by this builder.
protected  State addEndState(java.lang.String stateId, java.lang.String viewName)
          Adds an end state to the flow built by this builder.
protected  State addEndState(java.lang.String stateId, java.lang.String viewName, org.springframework.binding.mapping.AttributeMapper outputMapper)
          Adds an end state to the flow built by this builder.
protected  State addSubflowState(java.lang.String stateId, Action[] entryActions, Flow subflow, FlowAttributeMapper attributeMapper, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap attributes)
          Adds a subflow state to the flow built by this builder.
protected  State addSubflowState(java.lang.String stateId, Flow subflow, FlowAttributeMapper attributeMapper, Transition transition)
          Adds a subflow state to the flow built by this builder.
protected  State addSubflowState(java.lang.String stateId, Flow subflow, FlowAttributeMapper attributeMapper, Transition[] transitions)
          Adds a subflow state to the flow built by this builder.
protected  State addViewState(java.lang.String stateId, Action[] entryActions, ViewSelector viewSelector, Action[] renderActions, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap attributes)
          Adds a view state to the flow built by this builder.
protected  State addViewState(java.lang.String stateId, java.lang.String viewName, Action renderAction, Transition transition)
          Adds a view state to the flow built by this builder.
protected  State addViewState(java.lang.String stateId, java.lang.String viewName, Action renderAction, Transition[] transitions)
          Adds a view state to the flow built by this builder.
protected  State addViewState(java.lang.String stateId, java.lang.String viewName, Transition transition)
          Adds a view state to the flow built by this builder.
protected  State addViewState(java.lang.String stateId, java.lang.String viewName, Transition[] transitions)
          Adds a view state to the flow built by this builder.
protected  AnnotatedAction annotate(Action action)
          Wrap given action in an AnnotatedAction} to be able to annotate it with attributes.
protected  FlowAttributeMapper attributeMapper(java.lang.String id)
          Request that the attribute mapper with the specified name be used to map attributes between a parent flow and a spawning subflow when the subflow state being constructed is entered.
protected  java.lang.String back()
          Creates the back event id.
protected  java.lang.String cancel()
          Creates the cancel event id.
protected  java.lang.String delete()
          Creates the delete event id.
protected  java.lang.String edit()
          Creates the edit event id.
protected  java.lang.String error()
          Creates the error event id.
protected  org.springframework.binding.expression.Expression expression(java.lang.String expressionString)
          Parses the expression string into an evaluatable Expression object.
protected  java.lang.String finish()
          Creates the finish event id.
protected  Flow flow(java.lang.String id)
          Request that the Flow with the specified flowId be spawned as a subflow when the subflow state being built is entered.
protected  AttributeMap flowAttributes()
          Hook subclasses may override to provide additional properties for the flow built by this builder.
 EventFactorySupport getEventFactorySupport()
          Returns the configured event factory support helper for creating commonly used event identifiers that drive transitions created by this builder.
protected  TransitionCriteria ifReturnedSuccess(Action action)
          Creates a TransitionCriteria that will execute the specified action when the Transition is executed but before the transition's target state is entered.
 void init(java.lang.String flowId, AttributeMap attributes)
          Initialize this builder.
protected  void initBuilder()
          Hook method subclasses can override to initialize the flow builder.
protected  AnnotatedAction invoke(java.lang.String methodName, Action multiAction)
          Creates an annotated action decorator that instructs the specified method be invoked on the multi action when it is executed.
protected  AnnotatedAction invoke(java.lang.String methodName, MultiAction multiAction)
          Creates an annotated action decorator that instructs the specified method be invoked on the multi action when it is executed.
protected  org.springframework.binding.mapping.MappingBuilder mapping()
          Factory method that returns a new, fully configured mapping builder to assist with building Mapping objects used by a FlowAttributeMapper to map attributes.
protected  org.springframework.binding.method.MethodSignature method(java.lang.String method)
          Convert the encoded method signature string to a MethodSignature object.
protected  AnnotatedAction name(java.lang.String name, Action action)
          Creates an annotated action decorator that makes the given action an named action.
protected  java.lang.String no()
          Creates the no event id.
protected  TransitionCriteria on(java.lang.String transitionCriteriaExpression)
          Creates a transition criteria that is used to match a Transition.
protected  ActionResultExposer result(java.lang.String resultName)
          Factory method for a result exposer.
protected  ActionResultExposer result(java.lang.String resultName, ScopeType resultScope)
          Factory method for a result exposer.
protected  java.lang.String select()
          Creates the select event id.
 void setEventFactorySupport(EventFactorySupport eventFactorySupport)
          Sets the event factory support helper to use to create commonly used event identifiers that drive transitions created by this builder.
protected  org.springframework.binding.expression.SettableExpression settableExpression(java.lang.String expressionString)
          Parses the expression string into a settable Expression object.
protected  java.lang.String submit()
          Creates the submit event id.
protected  java.lang.String success()
          Creates the success event id.
protected  TargetStateResolver to(java.lang.String targetStateIdExpression)
          Creates a target state resolver for the given state id expression.
 java.lang.String toString()
           
protected  Transition transition(TransitionCriteria matchingCriteria, TargetStateResolver targetStateResolver)
          Creates a new transition.
protected  Transition transition(TransitionCriteria matchingCriteria, TargetStateResolver targetStateResolver, TransitionCriteria executionCriteria)
          Creates a new transition.
protected  Transition transition(TransitionCriteria matchingCriteria, TargetStateResolver targetStateResolver, TransitionCriteria executionCriteria, AttributeMap attributes)
          Creates a new transition.
 ViewSelector viewSelector(java.lang.String viewName)
          Factory method that creates a view selector from an encoded view name.
protected  java.lang.String yes()
          Creates the yes event id.
 
Methods inherited from class org.springframework.webflow.engine.builder.BaseFlowBuilder
buildEndActions, buildExceptionHandlers, buildGlobalTransitions, buildInlineFlows, buildInputMapper, buildOutputMapper, buildStartActions, buildStates, buildVariables, dispose, fromStringTo, fromStringTo, getFlow, getFlowServiceLocator, setFlow, setFlowServiceLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractFlowBuilder

protected AbstractFlowBuilder()
Default constructor for subclassing.


AbstractFlowBuilder

protected AbstractFlowBuilder(FlowServiceLocator flowServiceLocator)
Create an instance of an abstract flow builder, using the specified locator to obtain needed flow services at build time.

Parameters:
flowServiceLocator - the locator for services needed by this builder to build its Flow
Method Detail

getEventFactorySupport

public EventFactorySupport getEventFactorySupport()
Returns the configured event factory support helper for creating commonly used event identifiers that drive transitions created by this builder.


setEventFactorySupport

public void setEventFactorySupport(EventFactorySupport eventFactorySupport)
Sets the event factory support helper to use to create commonly used event identifiers that drive transitions created by this builder.


init

public void init(java.lang.String flowId,
                 AttributeMap attributes)
          throws FlowBuilderException
Description copied from interface: FlowBuilder
Initialize this builder. This could cause the builder to open a stream to an externalized resource representing the flow definition, for example.

Specified by:
init in interface FlowBuilder
Specified by:
init in class BaseFlowBuilder
Parameters:
flowId - the identifier to assign to the flow
attributes - custom attributes to assign to the flow
Throws:
FlowBuilderException - an exception occured building the flow

flowAttributes

protected AttributeMap flowAttributes()
Hook subclasses may override to provide additional properties for the flow built by this builder. Returns a empty collection by default.

Returns:
additional properties describing the flow being built, should not return null

initBuilder

protected void initBuilder()
Hook method subclasses can override to initialize the flow builder. Will be called by init(String, AttributeMap) after creating the initial Flow object. As a consequence, BaseFlowBuilder.getFlow() can be called to retrieve the Flow object under construction.


addViewState

protected State addViewState(java.lang.String stateId,
                             java.lang.String viewName,
                             Transition transition)
Adds a view state to the flow built by this builder.

Parameters:
stateId - the state identifier
viewName - the string-encoded view selector
transition - the sole transition (path) out of this state
Returns:
the fully constructed view state instance

addViewState

protected State addViewState(java.lang.String stateId,
                             java.lang.String viewName,
                             Transition[] transitions)
Adds a view state to the flow built by this builder.

Parameters:
stateId - the state identifier
viewName - the string-encoded view selector
transitions - the transitions (paths) out of this state
Returns:
the fully constructed view state instance

addViewState

protected State addViewState(java.lang.String stateId,
                             java.lang.String viewName,
                             Action renderAction,
                             Transition transition)
Adds a view state to the flow built by this builder.

Parameters:
stateId - the state identifier
viewName - the string-encoded view selector
renderAction - the action to execute on state entry and refresh; may be null
transition - the sole transition (path) out of this state
Returns:
the fully constructed view state instance

addViewState

protected State addViewState(java.lang.String stateId,
                             java.lang.String viewName,
                             Action renderAction,
                             Transition[] transitions)
Adds a view state to the flow built by this builder.

Parameters:
stateId - the state identifier
viewName - the string-encoded view selector
renderAction - the action to execute on state entry and refresh; may be null
transitions - the transitions (paths) out of this state
Returns:
the fully constructed view state instance

addViewState

protected State addViewState(java.lang.String stateId,
                             Action[] entryActions,
                             ViewSelector viewSelector,
                             Action[] renderActions,
                             Transition[] transitions,
                             FlowExecutionExceptionHandler[] exceptionHandlers,
                             Action[] exitActions,
                             AttributeMap attributes)
Adds a view state to the flow built by this builder.

Parameters:
stateId - the state identifier
entryActions - the actions to execute when the state is entered
viewSelector - the view selector that will make the view selection when the state is entered
renderActions - any 'render actions' to execute on state entry and refresh; may be null
transitions - the transitions (path) out of this state
exceptionHandlers - any exception handlers to attach to the state
exitActions - the actions to execute when the state exits
attributes - attributes to assign to the state that may be used to affect state construction and execution
Returns:
the fully constructed view state instance

addActionState

protected State addActionState(java.lang.String stateId,
                               Action action,
                               Transition transition)
Adds an action state to the flow built by this builder.

Parameters:
stateId - the state identifier
action - the single action to execute when the state is entered
transition - the single transition (path) out of this state
Returns:
the fully constructed action state instance

addActionState

protected State addActionState(java.lang.String stateId,
                               Action action,
                               Transition[] transitions)
Adds an action state to the flow built by this builder.

Parameters:
stateId - the state identifier
action - the single action to execute when the state is entered
transitions - the transitions (paths) out of this state
Returns:
the fully constructed action state instance

addActionState

protected State addActionState(java.lang.String stateId,
                               Action action,
                               Transition transition,
                               FlowExecutionExceptionHandler exceptionHandler)
Adds an action state to the flow built by this builder.

Parameters:
stateId - the state identifier
action - the single action to execute when the state is entered
transition - the single transition (path) out of this state
exceptionHandler - the exception handler to handle exceptions thrown by the action
Returns:
the fully constructed action state instance

addActionState

protected State addActionState(java.lang.String stateId,
                               Action[] entryActions,
                               Action[] actions,
                               Transition[] transitions,
                               FlowExecutionExceptionHandler[] exceptionHandlers,
                               Action[] exitActions,
                               AttributeMap attributes)
Adds an action state to the flow built by this builder.

Parameters:
stateId - the state identifier
entryActions - any generic entry actions to add to the state
actions - the actions to execute in a chain when the state is entered
transitions - the transitions (paths) out of this state
exceptionHandlers - the exception handlers to handle exceptions thrown by the actions
exitActions - the exit actions to execute when the state exits
attributes - attributes to assign to the state that may be used to affect state construction and execution
Returns:
the fully constructed action state instance

addDecisionState

protected State addDecisionState(java.lang.String stateId,
                                 Transition[] transitions)
Adds a decision state to the flow built by this builder.

Parameters:
stateId - the state identifier
transitions - the transitions (paths) out of this state
Returns:
the fully constructed decision state instance

addDecisionState

protected State addDecisionState(java.lang.String stateId,
                                 TransitionCriteria decisionCriteria,
                                 java.lang.String trueStateId,
                                 java.lang.String falseStateId)
Adds a decision state to the flow built by this builder.

Parameters:
stateId - the state identifier
decisionCriteria - the criteria that defines the decision
trueStateId - the target state on a "true" decision
falseStateId - the target state on a "false" decision
Returns:
the fully constructed decision state instance

addDecisionState

protected State addDecisionState(java.lang.String stateId,
                                 Action[] entryActions,
                                 Transition[] transitions,
                                 FlowExecutionExceptionHandler[] exceptionHandlers,
                                 Action[] exitActions,
                                 AttributeMap attributes)
Adds a decision state to the flow built by this builder.

Parameters:
stateId - the state identifier
entryActions - the entry actions to execute when the state enters
transitions - the transitions (paths) out of this state
exceptionHandlers - the exception handlers to handle exceptions thrown by the state
exitActions - the exit actions to execute when the state exits
attributes - attributes to assign to the state that may be used to affect state construction and execution
Returns:
the fully constructed decision state instance

addSubflowState

protected State addSubflowState(java.lang.String stateId,
                                Flow subflow,
                                FlowAttributeMapper attributeMapper,
                                Transition transition)
Adds a subflow state to the flow built by this builder.

Parameters:
stateId - the state identifier
subflow - the flow that will act as the subflow
attributeMapper - the mapper to map subflow input and output attributes
transition - the single transition (path) out of the state
Returns:
the fully constructed subflow state instance

addSubflowState

protected State addSubflowState(java.lang.String stateId,
                                Flow subflow,
                                FlowAttributeMapper attributeMapper,
                                Transition[] transitions)
Adds a subflow state to the flow built by this builder.

Parameters:
stateId - the state identifier
subflow - the flow that will act as the subflow
attributeMapper - the mapper to map subflow input and output attributes
transitions - the transitions (paths) out of the state
Returns:
the fully constructed subflow state instance

addSubflowState

protected State addSubflowState(java.lang.String stateId,
                                Action[] entryActions,
                                Flow subflow,
                                FlowAttributeMapper attributeMapper,
                                Transition[] transitions,
                                FlowExecutionExceptionHandler[] exceptionHandlers,
                                Action[] exitActions,
                                AttributeMap attributes)
Adds a subflow state to the flow built by this builder.

Parameters:
stateId - the state identifier
entryActions - the entry actions to execute when the state enters
subflow - the flow that will act as the subflow
attributeMapper - the mapper to map subflow input and output attributes
transitions - the transitions (paths) out of this state
exceptionHandlers - the exception handlers to handle exceptions thrown by the state
exitActions - the exit actions to execute when the state exits
attributes - attributes to assign to the state that may be used to affect state construction and execution
Returns:
the fully constructed subflow state instance

addEndState

protected State addEndState(java.lang.String stateId)
Adds an end state to the flow built by this builder.

Parameters:
stateId - the state identifier
Returns:
the fully constructed end state instance

addEndState

protected State addEndState(java.lang.String stateId,
                            java.lang.String viewName)
Adds an end state to the flow built by this builder.

Parameters:
stateId - the state identifier
viewName - the string-encoded view selector
Returns:
the fully constructed end state instance

addEndState

protected State addEndState(java.lang.String stateId,
                            java.lang.String viewName,
                            org.springframework.binding.mapping.AttributeMapper outputMapper)
Adds an end state to the flow built by this builder.

Parameters:
stateId - the state identifier
viewName - the string-encoded view selector
outputMapper - the output mapper to map output attributes for the end state (a flow outcome)
Returns:
the fully constructed end state instance

addEndState

protected State addEndState(java.lang.String stateId,
                            Action[] entryActions,
                            ViewSelector viewSelector,
                            org.springframework.binding.mapping.AttributeMapper outputMapper,
                            FlowExecutionExceptionHandler[] exceptionHandlers,
                            AttributeMap attributes)
Adds an end state to the flow built by this builder.

Parameters:
stateId - the state identifier
entryActions - the actions to execute when the state is entered
viewSelector - the view selector that will make the view selection when the state is entered
outputMapper - the output mapper to map output attributes for the end state (a flow outcome)
exceptionHandlers - any exception handlers to attach to the state
attributes - attributes to assign to the state that may be used to affect state construction and execution
Returns:
the fully constructed end state instance

viewSelector

public ViewSelector viewSelector(java.lang.String viewName)
Factory method that creates a view selector from an encoded view name. See TextToViewSelector for information on the conversion rules.

Parameters:
viewName - the encoded view selector
Returns:
the view selector

action

protected Action action(java.lang.String id)
                 throws FlowArtifactLookupException
Resolves the action with the specified id. Simply looks the action up by id and returns it.

Parameters:
id - the action id
Returns:
the action
Throws:
FlowArtifactLookupException - the action could not be resolved

action

protected Action action(java.lang.String beanId,
                        org.springframework.binding.method.MethodSignature methodSignature)
                 throws FlowArtifactLookupException
Creates a bean invoking action that invokes the method identified by the signature on the bean associated with the action identifier.

Parameters:
beanId - the id identifying an arbitrary java.lang.Object to be used as an action
methodSignature - the signature of the method to invoke on the POJO
Returns:
the adapted bean invoking action
Throws:
FlowArtifactLookupException - the action could not be resolved

action

protected Action action(java.lang.String beanId,
                        org.springframework.binding.method.MethodSignature methodSignature,
                        ActionResultExposer resultExposer)
                 throws FlowArtifactLookupException
Creates a bean invoking action that invokes the method identified by the signature on the bean associated with the action identifier.

Parameters:
beanId - the id identifying an arbitrary java.lang.Object to be used as an action
methodSignature - the signature of the method to invoke on the POJO
Returns:
the adapted bean invoking action
Throws:
FlowArtifactLookupException - the action could not be resolved

action

protected Action action(org.springframework.binding.expression.Expression expression)
Creates an evaluate action that evaluates the expression when executed.

Parameters:
expression - the expression to evaluate

action

protected Action action(org.springframework.binding.expression.Expression expression,
                        ActionResultExposer resultExposer)
Creates an evaluate action that evaluates the expression when executed.

Parameters:
expression - the expression to evaluate
resultExposer - the evaluation result exposer

expression

protected org.springframework.binding.expression.Expression expression(java.lang.String expressionString)
Parses the expression string into an evaluatable Expression object.

Parameters:
expressionString - the expression string, e.g. flowScope.order.number
Returns:
the evaluatable expression

settableExpression

protected org.springframework.binding.expression.SettableExpression settableExpression(java.lang.String expressionString)
Parses the expression string into a settable Expression object.

Parameters:
expressionString - the expression string, e.g. flowScope.order.number
Returns:
the evaluatable expression
Since:
1.0.2

method

protected org.springframework.binding.method.MethodSignature method(java.lang.String method)
Convert the encoded method signature string to a MethodSignature object. Method signatures are used to match methods on POJO services to invoke on a bean invoking action.

Encoded method signature format: Method without arguments:

       ${methodName}
 
Method with arguments:
       ${methodName}(${arg1}, ${arg2}, ${arg n})
 

Parameters:
method - the encoded method signature
Returns:
the method signature
See Also:
action(String, MethodSignature, ActionResultExposer)

result

protected ActionResultExposer result(java.lang.String resultName)
Factory method for a result exposer. A result exposer is used to expose an action result such as a method return value or expression evaluation result to the calling flow.

Parameters:
resultName - the result name
Returns:
the result exposer
See Also:
action(String, MethodSignature, ActionResultExposer)

result

protected ActionResultExposer result(java.lang.String resultName,
                                     ScopeType resultScope)
Factory method for a result exposer. A result exposer is used to expose an action result such as a method return value or expression evaluation result to the calling flow.

Parameters:
resultName - the result name
resultScope - the scope of the result
Returns:
the result exposer
See Also:
action(String, MethodSignature, ActionResultExposer)

annotate

protected AnnotatedAction annotate(Action action)
Wrap given action in an AnnotatedAction} to be able to annotate it with attributes.

Parameters:
action - the action to annotate
Returns:
the wrapped action
Since:
1.0.4

invoke

protected AnnotatedAction invoke(java.lang.String methodName,
                                 Action multiAction)
Creates an annotated action decorator that instructs the specified method be invoked on the multi action when it is executed. Use this when working with MultiActions to specify the method on the MultiAction to invoke for a particular usage scenario. Use the method(String) factory method when working with bean invoking actions.

Parameters:
methodName - the name of the method on the multi action instance
multiAction - the multi action
Returns:
the annotated action that when invoked sets up a context property used by the multi action to instruct it with what method to invoke
Since:
1.0.4

invoke

protected AnnotatedAction invoke(java.lang.String methodName,
                                 MultiAction multiAction)
                          throws FlowArtifactLookupException
Creates an annotated action decorator that instructs the specified method be invoked on the multi action when it is executed. Use this when working with MultiActions to specify the method on the MultiAction to invoke for a particular usage scenario. Use the method(String) factory method when working with bean invoking actions.

Parameters:
methodName - the name of the method on the multi action instance
multiAction - the multi action
Returns:
the annotated action that when invoked sets up a context property used by the multi action to instruct it with what method to invoke
Throws:
FlowArtifactLookupException

name

protected AnnotatedAction name(java.lang.String name,
                               Action action)
Creates an annotated action decorator that makes the given action an named action.

Parameters:
name - the action name
action - the action to name
Returns:
the annotated named action

attributeMapper

protected FlowAttributeMapper attributeMapper(java.lang.String id)
                                       throws FlowArtifactLookupException
Request that the attribute mapper with the specified name be used to map attributes between a parent flow and a spawning subflow when the subflow state being constructed is entered.

Parameters:
id - the id of the attribute mapper that will map attributes between the flow built by this builder and the subflow
Returns:
the attribute mapper
Throws:
FlowArtifactLookupException - no FlowAttributeMapper implementation was exported with the specified id

flow

protected Flow flow(java.lang.String id)
             throws FlowArtifactLookupException
Request that the Flow with the specified flowId be spawned as a subflow when the subflow state being built is entered. Simply resolves the subflow definition by id and returns it; throwing a fail-fast exception if it does not exist.

Parameters:
id - the flow definition id
Returns:
the flow to be used as a subflow, this should be passed to a addSubflowState call
Throws:
FlowArtifactLookupException - when the flow cannot be resolved

on

protected TransitionCriteria on(java.lang.String transitionCriteriaExpression)
Creates a transition criteria that is used to match a Transition. The criteria is based on the provided expression string.

Parameters:
transitionCriteriaExpression - the transition criteria expression, typically simply a static event identifier (e.g. "submit")
Returns:
the transition criteria
See Also:
TextToTransitionCriteria

to

protected TargetStateResolver to(java.lang.String targetStateIdExpression)
Creates a target state resolver for the given state id expression.

Parameters:
targetStateIdExpression - the target state id expression
Returns:
the target state resolver
See Also:
TextToTargetStateResolver

transition

protected Transition transition(TransitionCriteria matchingCriteria,
                                TargetStateResolver targetStateResolver)
Creates a new transition.

Parameters:
matchingCriteria - the criteria that determines when the transition matches
targetStateResolver - the resolver of the transition's target state
Returns:
the transition

transition

protected Transition transition(TransitionCriteria matchingCriteria,
                                TargetStateResolver targetStateResolver,
                                TransitionCriteria executionCriteria)
Creates a new transition.

Parameters:
matchingCriteria - the criteria that determines when the transition matches
targetStateResolver - the resolver of the transition's target state
executionCriteria - the criteria that determines if a matched transition is allowed to execute
Returns:
the transition

transition

protected Transition transition(TransitionCriteria matchingCriteria,
                                TargetStateResolver targetStateResolver,
                                TransitionCriteria executionCriteria,
                                AttributeMap attributes)
Creates a new transition.

Parameters:
matchingCriteria - the criteria that determines when the transition matches
targetStateResolver - the resolver of the transition's target state
executionCriteria - the criteria that determines if a matched transition is allowed to execute
attributes - transition attributes
Returns:
the transition

ifReturnedSuccess

protected TransitionCriteria ifReturnedSuccess(Action action)
Creates a TransitionCriteria that will execute the specified action when the Transition is executed but before the transition's target state is entered.

This criteria will only allow the Transition to complete execution if the Action completes successfully.

Parameters:
action - the action to execute after a transition is matched but before it transitions to its target state
Returns:
the transition execution criteria

success

protected java.lang.String success()
Creates the success event id. "Success" indicates that an action completed successfuly.

Returns:
the event id

error

protected java.lang.String error()
Creates the error event id. "Error" indicates that an action completed with an error status.

Returns:
the event id

submit

protected java.lang.String submit()
Creates the submit event id. "Submit" indicates the user submitted a request (form) for processing.

Returns:
the event id

back

protected java.lang.String back()
Creates the back event id. "Back" indicates the user wants to go to the previous step in the flow.

Returns:
the event id

cancel

protected java.lang.String cancel()
Creates the cancel event id. "Cancel" indicates the flow was aborted because the user changed their mind.

Returns:
the event id

finish

protected java.lang.String finish()
Creates the finish event id. "Finish" indicates the flow has finished processing.

Returns:
the event id

select

protected java.lang.String select()
Creates the select event id. "Select" indicates an object was selected for processing or display.

Returns:
the event id

edit

protected java.lang.String edit()
Creates the edit event id. "Edit" indicates an object was selected for creation or updating.

Returns:
the event id

add

protected java.lang.String add()
Creates the add event id. "Add" indicates a child object is being added to a parent collection.

Returns:
the event id

delete

protected java.lang.String delete()
Creates the delete event id. "Delete" indicates a object is being removed.

Returns:
the event id

yes

protected java.lang.String yes()
Creates the yes event id. "Yes" indicates a true result was returned.

Returns:
the event id

no

protected java.lang.String no()
Creates the no event id. "False" indicates a false result was returned.

Returns:
the event id

mapping

protected org.springframework.binding.mapping.MappingBuilder mapping()
Factory method that returns a new, fully configured mapping builder to assist with building Mapping objects used by a FlowAttributeMapper to map attributes.

Returns:
the mapping builder

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2007. All Rights Reserved.