[jboss-user] [JBoss jBPM] - Pattern 14 (ForEachActionHandler) and process-state

starbuxman do-not-reply at jboss.com
Sat Oct 6 16:02:06 EDT 2007


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4092285#4092285

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4092285



More information about the jboss-user mailing list