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?
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>
so you need to provide a value of 'input'
variable as
variableData.put("input", 1);
If your task is ServiceTask
then you can do like below
delegateExecution.setVariable("input",1);
For more help http://www.activiti.org/userguide/#bpmnExclusiveGateway
In process deploy time:
org.activiti.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory
and inject to ProcessEngineConfigurationImpl
In process execution time:
you can add process variables as variable of you defined expression. It could be result of your condition in Java: ${result == true}
variableData.put("result", resultOfJavaCondition);
taskService.complete(task.getId(), variableData);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With