org.springframework.webflow.engine.support
Class ConfigurableFlowAttributeMapper

java.lang.Object
  extended by org.springframework.webflow.engine.support.AbstractFlowAttributeMapper
      extended by org.springframework.webflow.engine.support.ConfigurableFlowAttributeMapper
All Implemented Interfaces:
java.io.Serializable, FlowAttributeMapper

public class ConfigurableFlowAttributeMapper
extends AbstractFlowAttributeMapper
implements java.io.Serializable

Generic flow attribute mapper implementation that allows mappings to be configured in a declarative fashion.

Two types of mappings may be configured, input mappings and output mappings:

  1. Input mappings define the rules for mapping attributes in a parent flow to a spawning subflow.
  2. Output mappings define the rules for mapping attributes returned from an ended subflow into the resuming parent.

The mappings defined using the configuration properties fully support bean property access. So an entry name in a mapping can either be "beanName" or "beanName.propName". Nested property values are also supported ("beanName.propName.nestedPropName"). When the from mapping string is enclosed in "${...}", it will be interpreted as an expression that will be evaluated against the flow execution request context.

Author:
Erwin Vervaet, Keith Donald, Colin Sampaleanu
See Also:
RequestContext, Serialized Form

Constructor Summary
ConfigurableFlowAttributeMapper()
           
 
Method Summary
 ConfigurableFlowAttributeMapper addInputAttribute(java.lang.String attributeName)
          Adds an input mapping that maps a single attribute in parent flow scope into the subflow input map.
 void addInputAttributes(java.lang.String[] attributeNames)
          Adds a collection of input mappings that map attributes in parent flow scope into the subflow input map.
 ConfigurableFlowAttributeMapper addInputMapping(org.springframework.binding.mapping.AttributeMapper inputMapping)
          Adds a new input mapping.
 void addInputMappings(org.springframework.binding.mapping.AttributeMapper[] inputMappings)
          Adds a collection of input mappings.
 ConfigurableFlowAttributeMapper addOutputAttribute(java.lang.String attributeName)
          Adds an output mapping that maps a single subflow output attribute into the flow scope of the resuming parent flow.
 void addOutputAttributes(java.lang.String[] attributeNames)
          Adds a collection of output mappings that map subflow output attributes into the scope of the resuming parent flow.
 ConfigurableFlowAttributeMapper addOutputMapping(org.springframework.binding.mapping.AttributeMapper outputMapping)
          Adds a new output mapping.
 void addOutputMappings(org.springframework.binding.mapping.AttributeMapper[] outputMappings)
          Adds a collection of output mappings.
protected  org.springframework.binding.expression.ExpressionParser getExpressionParser()
          Returns the configured expression parser.
protected  org.springframework.binding.mapping.AttributeMapper getInputMapper()
          Returns the input mapper to use to map attributes of a parent flow RequestContext to a subflow input attribute map.
 org.springframework.binding.mapping.AttributeMapper[] getInputMappings()
          Returns a typed-array of configured input mappings.
protected  org.springframework.binding.mapping.AttributeMapper getOutputMapper()
          Returns the output mapper to use to map attributes from a subflow output attribute map to the RequestContext.
 org.springframework.binding.mapping.AttributeMapper[] getOutputMappings()
          Returns a typed-array of configured output mappings.
 void setExpressionParser(org.springframework.binding.expression.ExpressionParser expressionParser)
          Set the expression parser responsible for parsing expression strings into evaluatable expression objects.
 java.lang.String toString()
           
 
Methods inherited from class org.springframework.webflow.engine.support.AbstractFlowAttributeMapper
createFlowInput, getMappingContext, mapFlowOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigurableFlowAttributeMapper

public ConfigurableFlowAttributeMapper()
Method Detail

setExpressionParser

public void setExpressionParser(org.springframework.binding.expression.ExpressionParser expressionParser)
Set the expression parser responsible for parsing expression strings into evaluatable expression objects.


addInputMapping

public ConfigurableFlowAttributeMapper addInputMapping(org.springframework.binding.mapping.AttributeMapper inputMapping)
Adds a new input mapping. Use when you need full control over defining how a subflow input attribute mapping will be perfomed.

Parameters:
inputMapping - the input mapping
Returns:
this, to support call chaining

addInputMappings

public void addInputMappings(org.springframework.binding.mapping.AttributeMapper[] inputMappings)
Adds a collection of input mappings. Use when you need full control over defining how a subflow input attribute mapping will be perfomed.

Parameters:
inputMappings - the input mappings

addOutputMapping

public ConfigurableFlowAttributeMapper addOutputMapping(org.springframework.binding.mapping.AttributeMapper outputMapping)
Adds a new output mapping. Use when you need full control over defining how a subflow output attribute mapping will be perfomed.

Parameters:
outputMapping - the output mapping
Returns:
this, to support call chaining

addOutputMappings

public void addOutputMappings(org.springframework.binding.mapping.AttributeMapper[] outputMappings)
Adds a collection of output mappings. Use when you need full control over defining how a subflow output attribute mapping will be perfomed.

Parameters:
outputMappings - the output mappings

addInputAttribute

public ConfigurableFlowAttributeMapper addInputAttribute(java.lang.String attributeName)
Adds an input mapping that maps a single attribute in parent flow scope into the subflow input map. For instance: "x" will result in the "x" attribute in parent flow scope being mapped into the subflow input map as "x".

Parameters:
attributeName - the attribute in flow scope to map into the subflow
Returns:
this, to support call chaining

addInputAttributes

public void addInputAttributes(java.lang.String[] attributeNames)
Adds a collection of input mappings that map attributes in parent flow scope into the subflow input map. For instance: "x" will result in the "x" attribute in parent flow scope being mapped into the subflow input map as "x".

Parameters:
attributeNames - the attributes in flow scope to map into the subflow

addOutputAttribute

public ConfigurableFlowAttributeMapper addOutputAttribute(java.lang.String attributeName)
Adds an output mapping that maps a single subflow output attribute into the flow scope of the resuming parent flow. For instance: "y" will result in the "y" attribute of the subflow output map being mapped into the flowscope of the resuming parent flow as "y".

Parameters:
attributeName - the subflow output attribute to map into the parent flow scope
Returns:
this, to support call chaining

addOutputAttributes

public void addOutputAttributes(java.lang.String[] attributeNames)
Adds a collection of output mappings that map subflow output attributes into the scope of the resuming parent flow. For instance: "y" will result in the "y" attribute of the subflow output map being mapped into the flowscope of the resuming parent flow as "y".

Parameters:
attributeNames - the subflow output attributes to map into the parent flow

getInputMappings

public org.springframework.binding.mapping.AttributeMapper[] getInputMappings()
Returns a typed-array of configured input mappings.

Returns:
the configured input mappings

getOutputMappings

public org.springframework.binding.mapping.AttributeMapper[] getOutputMappings()
Returns a typed-array of configured output mappings.

Returns:
the configured output mappings

getExpressionParser

protected org.springframework.binding.expression.ExpressionParser getExpressionParser()
Returns the configured expression parser. Can be used by subclasses that build mappings.


getInputMapper

protected org.springframework.binding.mapping.AttributeMapper getInputMapper()
Description copied from class: AbstractFlowAttributeMapper
Returns the input mapper to use to map attributes of a parent flow RequestContext to a subflow input attribute map.

Specified by:
getInputMapper in class AbstractFlowAttributeMapper
Returns:
the input mapper, or null if none
See Also:
AbstractFlowAttributeMapper.createFlowInput(RequestContext)

getOutputMapper

protected org.springframework.binding.mapping.AttributeMapper getOutputMapper()
Description copied from class: AbstractFlowAttributeMapper
Returns the output mapper to use to map attributes from a subflow output attribute map to the RequestContext.

Specified by:
getOutputMapper in class AbstractFlowAttributeMapper
Returns:
the output mapper, or null if none
See Also:
AbstractFlowAttributeMapper.mapFlowOutput(AttributeMap, RequestContext)

toString

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


Copyright © 2004-2007. All Rights Reserved.