http://community.jboss.org/wiki/ForEachForkActionHandler
ForEachForkActionHandler implements pattern 14, Multiple Instances with Run Time Knowledge. This is a Jbpm 3.0 port of the Jbpm 2.0 JbpmCustomForkhandler.
Example Usage: The calling code would set variable assets with a java.lang.List.
Note: The example file below uses some of the deprecated API. With 3.1.1, instead of executionContext.getProcessInstance().getJbpmSession().getSession().save(newToken);
use
executionContext.getJbpmContext().getSession().save(newToken);
ForEachForkActionHandler implements pattern 14, Multiple Instances with Run Time Knowledge. This is a Jbpm 3.0 port of the Jbpm 2.0 JbpmCustomForkhandler.
Example Usage: The calling code would set variable assets with a java.lang.List.
<process-definition name="foreachfork-example">
<start-state name="start">
<transition to="foreachfork" ></transition>
</start-state>
<node name="foreachfork">
<action class="com.xxx.workflow.ForEachForkActionHandler" config-type="bean">
<listVariable>assets</listVariable>
<as>asset</as>
</action>
<transition name="one" to="one"></transition>
<transition name="two" to="two"></transition>
</node>
<node name="one">
<script>
System.out.println("one: " + asset);
</script>
<transition to="joinforeach"></transition>
</node>
<node name="two">
<script>
System.out.println("two: " + asset);
</script>
<transition to="joinforeach"></transition>
</node>
<join name="joinforeach">
<transition to="end"></transition>
</join>
<end-state name="end"></end-state>
</process-definition>
Note: The example file below uses some of the deprecated API. With 3.1.1, instead of executionContext.getProcessInstance().getJbpmSession().getSession().save(newToken);
use
executionContext.getJbpmContext().getSession().save(newToken);