balimis
Apr 3rd, 2006, 06:52 AM
Hi,
in PR5 i have developed wizard webflow template which i can not port into 1.0EA. Here are details:
PR5
webflow controller:
<bean id="webflowController" class="org.springframework.webflow.mvc.FlowController"/>
flow def. example:
<bean id="book-reward" class="org.springframework.webflow.config.FlowFactoryBean">
<property name="flowBuilder">
<bean class="...servlet.webflow.OneStepWizardFlowBuilder">
<property name="firstView" value="bookreward"/>
<property name="finalView" value="bookreward-finish"/>
<property name="firstAction" value="bookPrepareAction"/>
<property name="preValidation" value="true"/>
</bean>
</property>
</bean>
OneStepWizardFlowBuilder extends org.springframework.webflow.config.AbstractFlowBui lder by overriding buildStates() method.
Main idea is to define wizard definitions as spring beans with the same flow definition constructed in OneStepWizardFlowBuilder - so no flow.xml is needed, only step views and validation, submit actions wiring.
Now in 1.0EA i can not understand how can i make the same construction. I'm trying this way, but cannot make it working:
<bean id="webflowController" class="org.springframework.webflow.executor.mvc.FlowContr oller">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
<bean id="flowExecutor" class="org.springframework.webflow.executor.FlowExecutorI mpl">
<constructor-arg >
<ref bean="flowRegistry"/>
</constructor-arg>
<property name="alwaysRedirectOnPause" value="true"/>
</bean>
<bean id="flowRegistry" class="org.springframework.webflow.registry.FlowRegistryF actoryBean">
<property name="flowRegistrars">
<list>
<ref bean="flowRegistrar" />
</list>
</property>
</bean>
<bean id="flowRegistrar" class="...servlet.utils.MyFlowRegistrar"/>
<bean id="book-reward" class="org.springframework.webflow.builder.FlowAssembler">
<constructor-arg value="book-reward"/>
<constructor-arg>
<bean class="...servlet.webflow.OneStepWizardFlowBuilder" autowire="byType">
<property name="firstView" value="bookreward"/>
<property name="finalView" value="bookreward-finish"/>
<property name="firstAction" value="prepareAction"/>
<property name="preValidation" value="true"/>
</bean>
</constructor-arg>
</bean>
and in MyFlowRegistrar.class:
public void registerFlows(FlowRegistry registry, FlowArtifactFactory flowArtifactFactory) {
Map beansMap = this.getApplicationContext().getParent().getBeansO fType(FlowAssembler.class);//getParent gives appContext initiated in web.xml
for (Iterator iter = beansMap.keySet().iterator(); iter.hasNext();) {
String beanName = (String) iter.next();
FlowAssembler flowAssembler = (FlowAssembler) beansMap.get(beanName);
registry.registerFlow(new RefreshableFlowHolder(flowAssembler));
}
}
but have exception:
org.springframework.webflow.FlowArtifactException: Unable to lookup action with
id 'prepareAction'; action lookup is not supported by this arti
fact factory
at org.springframework.webflow.builder.DefaultFlowArt ifactFactory.getAct
ion(DefaultFlowArtifactFactory.java:82)
at org.springframework.webflow.builder.AbstractFlowBu ilder.action(Abstra
ctFlowBuilder.java:460)
at ....servlet.webflow.OneStepWizardFlowBuilder.build S
tates(OneStepWizardFlowBuilder.java:47)
thanks in advance for any help,
Bali
in PR5 i have developed wizard webflow template which i can not port into 1.0EA. Here are details:
PR5
webflow controller:
<bean id="webflowController" class="org.springframework.webflow.mvc.FlowController"/>
flow def. example:
<bean id="book-reward" class="org.springframework.webflow.config.FlowFactoryBean">
<property name="flowBuilder">
<bean class="...servlet.webflow.OneStepWizardFlowBuilder">
<property name="firstView" value="bookreward"/>
<property name="finalView" value="bookreward-finish"/>
<property name="firstAction" value="bookPrepareAction"/>
<property name="preValidation" value="true"/>
</bean>
</property>
</bean>
OneStepWizardFlowBuilder extends org.springframework.webflow.config.AbstractFlowBui lder by overriding buildStates() method.
Main idea is to define wizard definitions as spring beans with the same flow definition constructed in OneStepWizardFlowBuilder - so no flow.xml is needed, only step views and validation, submit actions wiring.
Now in 1.0EA i can not understand how can i make the same construction. I'm trying this way, but cannot make it working:
<bean id="webflowController" class="org.springframework.webflow.executor.mvc.FlowContr oller">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
<bean id="flowExecutor" class="org.springframework.webflow.executor.FlowExecutorI mpl">
<constructor-arg >
<ref bean="flowRegistry"/>
</constructor-arg>
<property name="alwaysRedirectOnPause" value="true"/>
</bean>
<bean id="flowRegistry" class="org.springframework.webflow.registry.FlowRegistryF actoryBean">
<property name="flowRegistrars">
<list>
<ref bean="flowRegistrar" />
</list>
</property>
</bean>
<bean id="flowRegistrar" class="...servlet.utils.MyFlowRegistrar"/>
<bean id="book-reward" class="org.springframework.webflow.builder.FlowAssembler">
<constructor-arg value="book-reward"/>
<constructor-arg>
<bean class="...servlet.webflow.OneStepWizardFlowBuilder" autowire="byType">
<property name="firstView" value="bookreward"/>
<property name="finalView" value="bookreward-finish"/>
<property name="firstAction" value="prepareAction"/>
<property name="preValidation" value="true"/>
</bean>
</constructor-arg>
</bean>
and in MyFlowRegistrar.class:
public void registerFlows(FlowRegistry registry, FlowArtifactFactory flowArtifactFactory) {
Map beansMap = this.getApplicationContext().getParent().getBeansO fType(FlowAssembler.class);//getParent gives appContext initiated in web.xml
for (Iterator iter = beansMap.keySet().iterator(); iter.hasNext();) {
String beanName = (String) iter.next();
FlowAssembler flowAssembler = (FlowAssembler) beansMap.get(beanName);
registry.registerFlow(new RefreshableFlowHolder(flowAssembler));
}
}
but have exception:
org.springframework.webflow.FlowArtifactException: Unable to lookup action with
id 'prepareAction'; action lookup is not supported by this arti
fact factory
at org.springframework.webflow.builder.DefaultFlowArt ifactFactory.getAct
ion(DefaultFlowArtifactFactory.java:82)
at org.springframework.webflow.builder.AbstractFlowBu ilder.action(Abstra
ctFlowBuilder.java:460)
at ....servlet.webflow.OneStepWizardFlowBuilder.build S
tates(OneStepWizardFlowBuilder.java:47)
thanks in advance for any help,
Bali