[jboss-user] [JBoss jBPM] - Re: How to define a process definition that has multiples su

faite do-not-reply at jboss.com
Mon Dec 15 14:54:19 EST 2008


I made the next changes but it don't work, it don't stop at the join node.
Any ideas how to fix this?
Thanks

public class ForEachForkActionHandler implements ActionHandler 
  | {
  | 	private static final long serialVersionUID = 1L;
  | 	protected static final String FOREACH_PREFIX = "foreach.";
  | 
  |     /**
  |      * Create a new child token for each item in list.
  |      *
  |      * @param executionContext
  |      * @throws Exception
  |      */
  |     public void execute(final ExecutionContext executionContext) throws Exception 
  |     {
  |         final Token rootToken = executionContext.getToken();
  |         final Node node = executionContext.getNode();
  |         final List argSets = new LinkedList();
  |         
  |         for (int i = 0; i < node.getLeavingTransitions().size(); i++) {
  |             final Transition transition = (Transition) node.getLeavingTransitions().get(0);
  | 
  |             for (int j = 0; j < 2; j++) {
  | 
  |                 final Token newToken = new Token(rootToken, FOREACH_PREFIX + node.getId() + "." + j);
  |                 newToken.setTerminationImplicit(true);
  |                 executionContext.getJbpmContext().getSession().save(newToken);
  |                 
  |                 final ExecutionContext newExecutionContext = new ExecutionContext( newToken );
  |                 newExecutionContext.getContextInstance().createVariable( "message", "data " + j, newToken);               
  |                 argSets.add(new Object[] {newExecutionContext, transition});
  |             }
  |         }
  | 
  |         for (int i = 0; i < argSets.size(); i++) 
  |         {
  |             final Object[] args = (Object[]) argSets.get(i);
  |             node.leave((ExecutionContext) args[0], (Transition) args[1]);
  |         }
  |     }
  | 
  | }
  | 
  | 
  | <process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="listingloads">
  | 	<start-state name="load new file">
  | 		<transition to="fork1">
  | 		</transition>
  | 	</start-state>
  | 	<node name="fork1">
  | 		<action class="com.ldg.bpm.handler.fork.ForEachForkActionHandler">
  | 		</action>
  | 		<transition name="subprocess" to="process-state1"></transition>
  | 	</node>
  | 	<node name="process-state1">
  | 		<transition to="join1"></transition>
  | 	</node>
  | 	<join name="join1">
  | 		<transition to="end"></transition>
  | 	</join>
  | 	<end-state name="end"></end-state>
  | </process-definition>
  | 
  | 

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

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



More information about the jboss-user mailing list