[jboss-user] [JBoss jBPM] - Re: variable scope from a script

tbeernot do-not-reply at jboss.com
Sun Nov 23 09:30:52 EST 2008


Right. The methods are present, but they are not static. So: 


  | token.getProcessInstance().getContextInstance().setVariable("var","val", token)
  | 

But that does not give me the behavior I expect. 

Again I have the simple fork/join flow (start state forking state1 and state2) and each of these states has a node-enter event containing a setVariable as described above, but each setting a different value. 


  | 		       S
  | 		       |
  | 		       F   val="a"
  | 		      / \
  | 	    val="b"   s1 s2   val="c"
  | 		      \ /
  | 		       J
  | 		       |
  | 		       E
  | 

When the two childern have just forked, I iterate over ALL tokens in the workflow and do a 

  | lList.add( lContextInstance.getVariable("var", lToken) );
  | 

So at the end I would expect three different values in that list. 

I do have three values, but they are all the same ("b"). Since I get 3x the value associated with a child, it must actually be 3x the value of the root token. Which again means that the setVariable is not actually setting the variable in the token context, but the root token context.

Am I missing something?

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

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



More information about the jboss-user mailing list