From d7447d7a852e7ad9edb807e10a0864f6cf82eb6a Mon Sep 17 00:00:00 2001 From: Erwin Vervaet Date: Wed, 28 Mar 2007 11:58:19 +0000 Subject: [PATCH] Added DefaultFlowServiceLocator(String, BeanFactory) convenience constructor to the DefaultFlowServiceLocator --- spring-webflow/changelog.txt | 1 + .../builder/DefaultFlowServiceLocator.java | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/spring-webflow/changelog.txt b/spring-webflow/changelog.txt index 52e51f0a..5b228263 100644 --- a/spring-webflow/changelog.txt +++ b/spring-webflow/changelog.txt @@ -38,6 +38,7 @@ Package org.springframework.webflow.engine * The XmlFlowBuilder now consistently uses "fromStringTo(Class.class)" to resolve types (SWF-268). * Added AbstractFlowBuilderFlowRegistryFactoryBean for easy setup of a flow registry containing flows built using AbstractFlowBuilders. +* Added DefaultFlowServiceLocator(String, BeanFactory) convenience constructor to the DefaultFlowServiceLocator. 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/DefaultFlowServiceLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowServiceLocator.java index 171a81ee..bdd4699c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowServiceLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowServiceLocator.java @@ -47,15 +47,31 @@ public class DefaultFlowServiceLocator extends BaseFlowServiceLocator { /** * Creates a flow service locator that retrieves subflows from the provided * registry and additional artifacts from the provided bean factory. - * @param subflowRegistry The registry for loading subflows - * @param beanFactory The spring bean factory + * @param subflowRegistry the registry for loading subflows + * @param beanFactory the spring bean factory */ public DefaultFlowServiceLocator(FlowDefinitionRegistry subflowRegistry, BeanFactory beanFactory) { Assert.notNull(subflowRegistry, "The subflow registry is required"); - Assert.notNull(beanFactory, "The beanFactory is required"); + Assert.notNull(beanFactory, "The bean factory is required"); this.subflowRegistry = subflowRegistry; this.beanFactory = beanFactory; } + + /** + * Convenience flow service locator constructor that looks up a flow definition + * registry using given bean id in given bean factory. The registry is used + * to retrieve subflows. All additional artifacts are looked up in the provided + * bean factory. + * @param subflowRegistryBeanId the bean id of the subflow FlowDefinitionRegistry + * @param beanFactory the Spring bean factory + */ + public DefaultFlowServiceLocator(String subflowRegistryBeanId, BeanFactory beanFactory) { + Assert.notNull(subflowRegistryBeanId, "The subflow registry bean id is required"); + Assert.notNull(beanFactory, "The bean factory is required"); + this.subflowRegistry = + (FlowDefinitionRegistry)beanFactory.getBean(subflowRegistryBeanId, FlowDefinitionRegistry.class); + this.beanFactory = beanFactory; + } public Flow getSubflow(String id) throws FlowArtifactLookupException { try {