[jboss-dev-forums] [Design of JBoss jBPM] - Re: Fork with one path for every element of a collection

jeffdelong do-not-reply at jboss.com
Fri Mar 23 12:54:00 EDT 2007


You should probably post this to the user forum, as it is not a jBPM design issue per se.

However what you want to do is easy to do with an action at a node that has code as follows where you get forkCount from the size of your collection, e.g.,


  | 	Node fork = rootToken.getNode();
  | 
  | 			if (forkCount > 0) {
  | 				// create a child token for every fork
  | 				for (int 0 = 1; i < forkCount; i++) {
  | 				
  | 					List<Transition> transitions = fork.getLeavingTransitions();
  | 					Iterator iter = transitions.iterator();
  | 					// need to iterate through the leaving transitions
  | 					// although we only have one
  | 					while (iter.hasNext()) {
  | 						Transition leavingTransition = (Transition) iter.next();
  | 						String childTokenName = leavingTransition.getName();
  | 						Token childToken = new Token(rootToken, childTokenName);
  | 						ci.setVariable("x", x, childToken);
  | 						ExecutionContext childExecutionContext = new ExecutionContext(
  | 								childToken);
  | 						fork.leave(childExecutionContext, childTokenName);
  | 					}
  | 				}
  | 			}

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

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



More information about the jboss-dev-forums mailing list