[jbpm-users] [JBoss jBPM] - Re: variable scope from a script

mputz do-not-reply at jboss.com
Tue Nov 25 08:44:41 EST 2008


There is a test case that covers this scenario:
http://fisheye.jboss.org/browse/JBPM/jbpm.3/jpdl/jar/src/test/java/org/jbpm/context/exe/VariableScopingTest.java?r=1.1

Looking at testScopeOverriding(), this works properly if the createVariable(String name, Object value, Token token) is used. 

The results are different if setVariable(String name, Object value, Token token) is used, which is also documented in the javadocs:

  /**
  |    * sets a variable. If a variable exists in the scope given by the token, that
  |    * variable is updated. Otherwise, the variable is created on the root token
  |    * (=process instance scope).
  |    */
  |   public void setVariable(String name, Object value, Token token) {

In order to use setVariable on different tokens, the variables have to be created first with createVariable, otherwise they will all end up being referenced by the root token.

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

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



More information about the jbpm-users mailing list