I am rather new to SWF, and I'm trying to figure out how to use subflows.
I got something working, but I'm not sure I understand the end-state part of a subflow completely, so I hope someone can clarify it for me.
Here is my example:
The masterflow:
and the Subflow (which also can be used a a Masterflow in some other context)Code:<view-state id="bookList"> <transition on="toDetails" to="bookDetail" /> </view-state> <view-state id="bookDetail"> <transition on="toList" to="bookList"></transition> <transition on="showAuthor" to="showAuthor"></transition> </view-state> <subflow-state id="showAuthor" subflow="author" > <transition on="endSubFlow" to="bookDetail" ></transition> </subflow-state>
And the things that I'm not sure of:Code:<view-state id="author"> <transition on="showAuthorSelected" > <evaluate expression="authorController.findAuthor(requestParameters.authorId)" result="viewScope.selectedAuthor"></evaluate> </transition> <transition on="showBookDetail" to="endSubFlow" ></transition> </view-state> <end-state id="endSubFlow"></end-state>
In the subflow definition in the masterflow - do I have to define a transition for every end-state that the subflow contains? What exactly happens if I don't do that? Say that the subflow could also contains an end-state like
<end-state id="confuseMe"/>, but the masterflow does not have a transition for that?
And if my end-state in the subflow is defined with a view like this
<end-state id="endSubFlow" view="externalRedirect:some-URL"></end-state>
will the externalRedirect occur when the flow is used as a subflow, or will it just return to the masterflow, which already have another definition of what to do when "endSubFlow" is returned?
What I'm really trying to figure out is how to reuse flows both in the context of it being the Masterflow, but also working as a subflow. So the transitions in the flow might depend on whether the flow is being executed as a master- or subflow.
Does it make sense at all??![]()


Reply With Quote
