[rules-users] question about Process Instances

Kris Verlaenen kris.verlaenen at cs.kuleuven.be
Wed Oct 28 07:39:59 EDT 2009


Daniel,

Yes there is. We did not expose it in the drools-api because it should
probably not be used as a preferred solution, because it could lead to
you changing process instance data in the middle of the process
execution, create confusion if you have nested variable scopes, etc.  In
general, work item nodes and event nodes could also be used to insert
new data into the process.

If you cast your process instance to an internal class, you can use the
following code:

org.drools.process.instance.ProcessInstance processInstance = ...
VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
  processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
variableScopeInstance.setVariable(name, value);

I've also added this method to WorkflowProcessInstanceImpl, so if you
can update to the latest trunk, you can simply do:
RuleFlowProcessInstance processInstance = ...
processInstance.setVariable(name, value);

Kris

Quoting Daniel Miller <dmiller at versatile.com>:

> Another question about Process Instances:
> 
> Is there a way to inject variables into a running process instance? 
> I  
> know when I start the process I can pass a Map of variables, but is 
> 
> there a way to continue injecting variables -- like  
> processInstance.setVariable("myVariable",myValuedObject); ?
> 
> Thanks,
> 
> Dan Miller
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the rules-users mailing list