This content has been marked as final.
Show 4 replies
-
1. Re: Fork with one path for every element of a collection
jeffdelong Mar 23, 2007 12:54 PM (in response to camunda)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); } } }
-
2. Re: Fork with one path for every element of a collection
tom.baeyens Mar 23, 2007 1:42 PM (in response to camunda)good input. i want to review the jpdl language sometime. mainly the fork/join options can do with quite some rethinking.
referencing a collection is a good this. also you should be able to configure a variable name in which the item is injected for that particular child token.
thanks.
regards, tom. -
4. Re: Fork with one path for every element of a collection
camunda Mar 26, 2007 4:55 PM (in response to camunda)Wow, cool. Thanks a lot!!
I haven't found that before...
And yes Tom, it would be cool to have that in a "standard fork" in future...
Bernd.