使用Java API设置/获取Camunda用户任务的输入/输出参数
我有简单的工作流程:使用Java API设置/获取Camunda用户任务的输入/输出参数,java,workflow,bpmn,business-process-management,camunda,Java,Workflow,Bpmn,Business Process Management,Camunda,我有简单的工作流程: [start_workflow] -> [user_task] -> -> [exclusive_gateway] -> (two routes see below) -> [end_workflow] [exclusive_gateway]有两条传出路由: 1.) ${if user_task output paramterer == null} -> [NULL_service_task] -> [end_workflow]
[start_workflow] -> [user_task] ->
-> [exclusive_gateway] -> (two routes see below) -> [end_workflow]
[exclusive_gateway]有两条传出路由:
1.) ${if user_task output paramterer == null} -> [NULL_service_task] -> [end_workflow]
2.) ${if user_task output paramterer != null} -> [NOT_null_service_task] -> [end_workflow]
在Camunda Modeler中,我在[user_task]中添加了一个名为out的输出参数
问:
在通过以下方式完成任务之前,如何通过Java API设置输出参数:
taskService.complete(taskId);
在[exclusive_gateway]箭头上,我设置了以下内容:
Condition type = expression
Expression = ${out != null}
但还有更多:
如果在完成任务之前删除[user_task]的输出参数并设置runtimeService变量:
runtimeService.setVariable(processInstanceId, "out", name);
[exclusive_gateway]处理参数,并按预期路由流。
在不删除[user_task]的输出参数的情况下,它看起来像:
1.它从未设置为如此==null
2.此空值覆盖由设置的值
runtimeService.setVariable(processInstanceId, "out", name);
那么,我可以通过Java API设置任务的输出参数,还是只能使用流程变量?我想您正在寻找
taskService.complete(<taskId>, Variables.putValue("out", <name>);
任务和值的网关转发之间的通信是通过在完成时设置流程变量out来实现的
有关更多信息,请查看