|
From: Erwin V. <erw...@er...> - 2005-03-29 21:16:24
|
> How should you do this in web flow? > > > formState --(eventA, eventB, eventC)--> state1 ----> state2 --(?)--> > > We have a form that can submit three separate events (eventA, eventB, > and eventC). In the web flow, we want all three events to go to state1, > then state2, then branch to another state based on the event fired from > formState. > > > formState --(eventA)--> subFlowState1 --(eventX)--> > formState --(eventB)--> subFlowState2 --(eventY)--> > formState --(eventC)--> subFlowState3 --(eventZ)--> > > Right now, we have resorted to creating a subFlow that contains state1 > and state2 and then defining three separate subFlow states > (subFlowState1, subFlowState2, and subFlowState3) in the parent flow > using the same subFlow definition with different transitions. > > Because we have several cases like this, the number of subFlows required > is getting a little unwieldy. Anyone else have any suggestions as to > how we could do this in a better way? I'm not sure I understand why your solution leads to an unwieldy number of subflows: e.g. in your example you have 3 subflow states, but only 1 subflow definition right? Anyway, I have found it to be a best practice to not try and reuse a state definitions in a flow. A state reuses an action implementation, but is not itself intented to be a reusable component. This can lead to flows that are a bit more elaborate in definition, but they will also be very simple to read. If you really don't like that, you could also put some discriminating value in the flow scope and use that to implement a switch in your flow: e.g. have a SignalEventAction that takes the discriminator from the flow scope and returns it as an event. Erwin |