我想从java类中的bpmn获取数据。我的代码是:
Map<String, Object> params = new HashMap<String, Object>();
params.put("s", s);
params.put("p", s);
params.put("result", result);
ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn");
// check whether the process instance has completed successfully
assertProcessInstanceCompleted(processInstance.getId(), ksession);
assertNodeTriggered(processInstance.getId(), "Script Task 1");
我将变量“结果”发送到bpmn并在bpmn中更改“结果”。现在我想得到值在java类中修改“结果”
答案 0 :(得分:0)
有一个很好的例子,如何在jBPM documentation中执行此操作。您只需要将processInstance变量强制转换为WorkflowProcessInstance:
result = ((WorkflowProcessInstance) processInstance).getVariable("result");