This content has been marked as final.
Show 2 replies
-
1. Re: How to connect a disconnected process instance?
awizenm Apr 17, 2015 5:15 AM (in response to awizenm)The solution was RTFM ;-)
see: http://docs.jboss.org/jbpm/v6.2/userguide/jBPMBPMN2.html#d0e3731
My actual intention was to modify (or to set) the process variable.
So this is what works for me now:
ksession.execute(new GenericCommand<Map<String, Object>>() { @Override public Map<String, Object> execute(Context context) { KieSession ksession = ((KnowledgeCommandContext) context).getKieSession(); org.jbpm.process.instance.ProcessInstance processInstance = (org.jbpm.process.instance.ProcessInstance) ksession.getProcessInstance(id); VariableScopeInstance variableScope = (VariableScopeInstance) processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE); Map<String, Object> variables = variableScope.getVariables(); variableScope.setVariable("userAction", "deleteAction"); return variables; } });
-
2. Re: How to connect a disconnected process instance?
awizenm Apr 17, 2015 11:18 AM (in response to awizenm)While the GenericCommand solution works, it is presumably not the preferred way of passing data in a jBPM 6.2 processes.
So I have created an Output Data Mapping in my Task:
Now in the test class I can pass the value on the task completion.
Map<String, Object> results = new HashMap<String, Object>(); results.put("userAction", "deleteAction"); taskService.complete(taskSummary.getId(), "userA", results);
And then the variable "userAction" is available for the evaluation in the subsequent split in the process.