Activiti5驳回
时间: 2023-10-28 13:10:29 浏览: 95
Activiti5学习笔记
3星 · 编辑精心推荐
在 Activiti 5 中,驳回功能可以通过以下两种方式实现:
1. 使用 `exclusiveGateway` 和 `userTask` 元素:在流程中添加一个 `exclusiveGateway` 元素,将其与要驳回的目标 `userTask` 元素相连。在 `exclusiveGateway` 元素的条件中,判断是否需要驳回,如果需要驳回,则将流程实例的当前任务设置为目标 `userTask` 元素,即可实现驳回功能。
以下是一个示例流程定义文件:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="http://www.activiti.org/processdef">
<process id="process"
name="Process"
isExecutable="true">
<startEvent id="startEvent"
name="Start">
<outgoing>flow1</outgoing>
</startEvent>
<userTask id="userTask1"
name="Task 1">
<incoming>flow1</incoming>
<outgoing>flow2</outgoing>
</userTask>
<exclusiveGateway id="exclusiveGateway"
name="Gateway">
<incoming>flow2</incoming>
<outgoing>flow3</outgoing>
<outgoing>flow4</outgoing>
</exclusiveGateway>
<userTask id="userTask2"
name="Task 2">
<incoming>flow3</incoming>
<outgoing>flow5</outgoing>
</userTask>
<userTask id="userTask3"
name="Task 3">
<incoming>flow4</incoming>
<outgoing>flow6</outgoing>
</userTask>
<sequenceFlow id="flow1"
sourceRef="startEvent"
targetRef="userTask1" />
<sequenceFlow id="flow2"
sourceRef="userTask1"
targetRef="exclusiveGateway" />
<sequenceFlow id="flow3"
sourceRef="exclusiveGateway"
targetRef="userTask2">
<conditionExpression xsi:type="tFormalExpression">${rejected}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4"
sourceRef="exclusiveGateway"
targetRef="userTask3">
<conditionExpression xsi:type="tFormalExpression">${!rejected}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow5"
sourceRef="userTask2"
targetRef="endEvent" />
<sequenceFlow id="flow6"
sourceRef="userTask3"
targetRef="endEvent" />
<endEvent id="endEvent"
name="End">
<incoming>flow5</incoming>
<incoming>flow6</incoming>
</endEvent>
</process
阅读全文