diff --git a/spring-webflow/changelog.txt b/spring-webflow/changelog.txt index 5b228263..158e01ab 100644 --- a/spring-webflow/changelog.txt +++ b/spring-webflow/changelog.txt @@ -39,6 +39,9 @@ Package org.springframework.webflow.engine * Added AbstractFlowBuilderFlowRegistryFactoryBean for easy setup of a flow registry containing flows built using AbstractFlowBuilders. * Added DefaultFlowServiceLocator(String, BeanFactory) convenience constructor to the DefaultFlowServiceLocator. +* Added BeanFactoryFlowVariable(String, BeanFactory, ScopeType) convenience constructor to the + BeanFactoryFlowVariable. +* Added settableExpression() method to AbstractFlowBuilder. Package org.springframework.webflow.execution * Added FlowExecutionListener.sessionCreated(RequestContext, FlowSession) callback, useful for diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilder.java index aefe7546..0789438a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilder.java @@ -16,6 +16,7 @@ package org.springframework.webflow.engine.builder; import org.springframework.binding.expression.Expression; +import org.springframework.binding.expression.SettableExpression; import org.springframework.binding.mapping.AttributeMapper; import org.springframework.binding.mapping.Mapping; import org.springframework.binding.mapping.MappingBuilder; @@ -560,14 +561,22 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Parses the expression string into a evaluatable {@link Expression} - * object. + * Parses the expression string into an evaluatable {@link Expression} object. * @param expressionString the expression string, e.g. flowScope.order.number * @return the evaluatable expression */ protected Expression expression(String expressionString) { return getFlowServiceLocator().getExpressionParser().parseExpression(expressionString); } + + /** + * Parses the expression string into a settable {@link Expression} object. + * @param expressionString the expression string, e.g. flowScope.order.number + * @return the evaluatable expression + */ + protected SettableExpression settableExpression(String expressionString) { + return getFlowServiceLocator().getExpressionParser().parseSettableExpression(expressionString); + } /** * Convert the encoded method signature string to a {@link MethodSignature} diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BeanFactoryFlowVariable.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BeanFactoryFlowVariable.java index ba8320d0..c57e3146 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BeanFactoryFlowVariable.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BeanFactoryFlowVariable.java @@ -27,6 +27,7 @@ import org.springframework.webflow.execution.ScopeType; * {@link BeanFactory}. * * @author Keith Donald + * @author Erwin Vervaet */ public class BeanFactoryFlowVariable extends FlowVariable { @@ -40,6 +41,18 @@ public class BeanFactoryFlowVariable extends FlowVariable { * The bean factory where initial variable values will be obtained. */ private BeanFactory beanFactory; + + /** + * Convenience constructor to create a new bean factory flow variable. + * Defaults the bean name to the variable name. + * @param name the variable name which will also be used as the bean name + * @param beanFactory the bean factory where initial variable values will be + * obtained + * @param scope the variable scope + */ + public BeanFactoryFlowVariable(String name, BeanFactory beanFactory, ScopeType scope) { + this(name, name, beanFactory, scope); + } /** * Creates a new bean factory flow variable.