本文介绍了Activiti - 如何在 Java 中为独占网关设置条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Activiti 中有一个独占网关,如何在 Java 代码中为独占网关设置条件变量?

I have an exclusive gateway in Activiti, how I can set the condition variable in Java code for exclusive gateway?

variableData.put("condition", conditionVar);
taskService.complete(task.getId(), variableData);

如何在网关流上提取任务变量?是否可能或我必须使用过程变量?

How I can extract task variable on gateway flow? Is it possible or I have to use process variable?

推荐答案

当您使用条件独占网关设计工作流时,它会生成如下所示的 XML,

When you design your workflow with conditional exclusive gateway then it will generate XML like below,

<exclusiveGateway id="exclusiveGw" name="Exclusive Gateway" />

<sequenceFlow id="flow2" sourceRef="exclusiveGw" targetRef="theTask1">
  <conditionExpression xsi:type="tFormalExpression">${input == 1}</conditionExpression>
</sequenceFlow>

所以你需要提供一个 'input' 变量的值作为

so you need to provide a value of 'input' variable as

variableData.put("input", 1);

如果你的任务是 ServiceTask 那么你可以像下面这样操作

If your task is ServiceTask then you can do like below

delegateExecution.setVariable("input",1);

如需更多帮助 http://www.activiti.org/userguide/#bpmnExclusiveGateway

这篇关于Activiti - 如何在 Java 中为独占网关设置条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 07:56