首先要在camunda中创建流程并使用过程变量。我可以成功创建这些过程变量,然后在服务任务中读取它们,然后使用Input / Output参数输出它们。但是我正努力从实际开始该流程的程序中再次检索这些参数的更新值。以下是代码段:
//测试用例
RuntimeService rs = processEngine().getRuntimeService();
Map<String, Object> variables = new HashMap<>();
variables.put("percentageCompletion", "11");
ProcessInstance processInstance = rs.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables);
通过执行此操作,可以在服务任务中访问此percentageCompletion
Object pc = execution.getVariable("percentageCompletion");// Update and set its new value
现在如何在测试用例中再次获取percentageCompletion
的更新值?我已经关注过类似的问题Process Variables in Camunda-BPM
答案 0 :(得分:-1)
这就是我能够在junit中获取它们的方式
SELECT distinct
J.JobID, P.PREDEFINEDDOCID
FROM Job J
Join JOBTEMPLATECONTEXT JT
on JT.jobid = J.JobID
and J.JobFetch = "Y"
Join DEPARTMENTJOB DJ
on DJ.JOBID = J.JOBID
and DJ.DepartmentJobFetch = "Y"
and UPPER(DJ.DEPARTMENTJOBSTATUS) in ("ACTIVE", "PENDING")
Join TEMPLATECONTEXT T
on T.TEMPLATECONTEXTID = JT.TEMPLATECONTEXTID
join PREDEFINEDDOC P on P.PREDEFINEDDOCID = T.TEMPCONTEXTID
join JOBDOCUMENTS JD
on JT.JOBID = JD.JOBID
join DOCUMENTS D
on D.PredefinedDocID = P.PREDEFINEDDOCID
and D.DOCUMENTFETCH = "Y"
and JD.DOCUMENTID = D.DOCUMENTID