Colin Yates
Jun 16th, 2005, 05:36 AM
Hi all,
A couple of questions. I have an action ActionA which locks a series of objects. I want to pass in a strategy which determines the objects to lock.
There are a couple of implementations, used in different flows. I don't really want to have one bean in context.xml per strategy implementation, what I want is to effectively autowire in the flow.xml, i.e.:
context.xml
<bean id="lockAction"/> <!-- the action that locks the objects -->
<bean id="individualObject"/> <!-- an implementation provide the objects -->
<bean id="objectAndChildren"/> <!-- an implementation provide the objects -->
and then in flow do something like:
flow.xml
<action name="lockAction">
<property name="objectRetrievalStrategy">
<ref bean="objectAndChildren"/>
</property>
</action>
in another flow:
<action name="lockAction">
<property name="objectRetrievalStrategy">
<ref bean="individualObject"/>
</property>
</action>
If I cannot do this, then I suppose I could chain the two actions, and have the strategy populate the event or context that the lockAction then uses.
If I chose this second approach, what would be the best approach in returning information from one event to another in the following scenarios:
a: actionA is followed immediately by actionB
b: actionA is followed by actionB which is followed by actionC, and actionC needs information produced by actionA.
Should I populate the event, or the request context?
Many thanks.
Colin
A couple of questions. I have an action ActionA which locks a series of objects. I want to pass in a strategy which determines the objects to lock.
There are a couple of implementations, used in different flows. I don't really want to have one bean in context.xml per strategy implementation, what I want is to effectively autowire in the flow.xml, i.e.:
context.xml
<bean id="lockAction"/> <!-- the action that locks the objects -->
<bean id="individualObject"/> <!-- an implementation provide the objects -->
<bean id="objectAndChildren"/> <!-- an implementation provide the objects -->
and then in flow do something like:
flow.xml
<action name="lockAction">
<property name="objectRetrievalStrategy">
<ref bean="objectAndChildren"/>
</property>
</action>
in another flow:
<action name="lockAction">
<property name="objectRetrievalStrategy">
<ref bean="individualObject"/>
</property>
</action>
If I cannot do this, then I suppose I could chain the two actions, and have the strategy populate the event or context that the lockAction then uses.
If I chose this second approach, what would be the best approach in returning information from one event to another in the following scenarios:
a: actionA is followed immediately by actionB
b: actionA is followed by actionB which is followed by actionC, and actionC needs information produced by actionA.
Should I populate the event, or the request context?
Many thanks.
Colin