0 Replies Latest reply on Oct 6, 2007 4:02 PM by starbuxman

    Pattern 14 (ForEachActionHandler) and process-state

    starbuxman

      Hi all

      I'm trying to create an iterated subprocess (basically, pattern 14
      http://www.workflowpatterns.com/patterns/control/multiple_instance/wcp14.php ). I found http://wiki.jboss.org/wiki/attach?page=ForEachForkActionHandler%2FForEachForkActionHandler.java

      which provides the ability to, on a node, specify that all leaving transitions are looped 'for each' item in a list. This works as expected with a simple node that as some script. i havent checked how it fares for task-nodes (which, invariably) is what i want.

      What im trying to do is spawn a sub process for each item in the list.

      I have the leaving transition wired to a process-state node which and that fails as the ForEachActionHandler.java gets to calling leave().

      Simple nodes: fine
      Process-state nodes: not so good.

      Below are my 2 process definitions.

      
      <process-definition name="foreach2">
      
       <start-state name="start">
       <transition to="foreachfork" />
       </start-state>
      
       <node name="foreachfork">
       <action class="com.my.test.workflow.util.ForEachActionHandler"
       config-type="bean">
       <listVariable>assets</listVariable>
       <as>asset</as>
       </action>
       <transition name="foreach2_sub" to="foreach2_sub"/>
       </node>
      
       <process-state name="foreach2_sub">
       <sub-process name="foreach2_sub" />
       <variable name="asset" access="read,write" mapped-name="asset" />
       <transition to="joinforeach" />
       </process-state>
      
       <join name="joinforeach">
       <transition to="end"/>
       </join>
      
       <end-state name="end"/>
      
      
      </process-definition>
      



      <process-definition name="foreach2_sub">
       <start-state name="start">
       <transition to="one" />
       </start-state>
      
       <node name="one">
       <script>
       System.out.println("foreach2_sub one: " + asset);
       </script>
       <transition to="two"/>
       </node>
       <node name="two">
       <script>
       System.out.println("foreach2_sub two: " + asset);
       </script>
       <transition to="end"/>
       </node>
      
       <end-state name="end"/>
      </process-definition>
      



      Thank you for any help,

      Josh Long
      Sun Certified Java Programmer
      http://www.joshlong.com