[jboss-user] [JBoss jBPM] - Re: fork and join childeren

tbeernot do-not-reply at jboss.com
Thu Nov 13 13:54:26 EST 2008


"salaboy21" wrote : The fork node is not a wait state.. so if you signal the start-state, the process will continue passing thru the fork node until reach the S1 and S2 nodes...
  | 
  | So do this test:
  | 
  | 1) signal de root token
  | 2) look for childrens.. at this time with only one signal.. you must have 2 children.
  | 3) then you can signal one of the child tokens and you see that the root token still in the fork node and the child token go to join node
  | 4) then signal the other token and you will see that the root token moves to the end and the child token like the other move to join node...
  | 
  | Can you do that test and post your code?
  | 


Sure!



  | 	public void test() 
  | 	{
  | 		// Declare a process with a fork
  | 		//       S
  | 		//       |
  | 		//       F
  | 		//      / \
  | 		//     s1 s2
  | 		//      \ /
  | 		//       J
  | 		//       |
  | 		//       E
  | 		ProcessDefinition lProcessDefinition = ProcessDefinition.parseXmlString(
  | 			"<process-definition>" +
  | 			"   <start-state name=\"start\">" + 
  | 			"		<transition to=\"fork1\"></transition>" + 
  | 			"	</start-state>" + 
  | 			"   <fork name=\"fork1\">" + 
  | 			"		<transition to=\"state1\"></transition>" + 
  | 			"		<transition to=\"state2\"></transition>" + 
  | 			"	</fork>" + 
  | 			"	<state name=\"state1\">" + 
  | 			"		<transition to=\"join1\"></transition>" + 
  | 			"	</state>" + 
  | 			"	<state name=\"state2\">" + 
  | 			"		<transition to=\"join1\"></transition>" + 
  | 			"	</state>" + 
  | 			"	<join name=\"join1\">" + 
  | 			"		<transition to=\"end\"></transition>" + 
  | 			"	</join>" + 
  | 			"   <end-state name=\"end\"></end-state>" +
  | 			"</process-definition>"
  | 		);
  | 		
  | 		// Start a process
  | 		ProcessInstance lProcessInstance = new ProcessInstance(lProcessDefinition);
  | 		
  | 		// Get the token: we're in the start node
  | 		Token lToken = lProcessInstance.getRootToken();
  | 		System.out.println("1: " + lToken.getNode()); 
  | 		
  | 		// First signal: goto the fork
  | 		lToken.signal();
  | 		// this should mean that this token gets two childeren
  | 		System.out.println("2a: " + lToken.getChildren().size()); 
  | 		// this token should still be in the fork
  | 		System.out.println("2b: " + lToken.getNode()); 
  | 		// this token should still be in the fork
  | 		System.out.println("2c: " + lToken.getChildren());
  | 		Token lChild1 = (Token)lToken.getChildren().values().iterator().next();
  | 		//Token lChild2 = (Token)lToken.getChildren().values().iterator().next();
  | 		// the childeren should be in state1 and state2
  | 		System.out.println("2d: " + lChild1.getNode()  ); 
  | 		//System.out.println("2e: " + lChild2.getNode()  ); 
  | 	}
  | 

I commented out lines because I do not have two childeren:

1: StartState(start)
2a: 1
2b: Fork(fork1)
2c: {1=Token(/1)}
2d: State(state1)

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

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



More information about the jboss-user mailing list