Flowable是一个开源的工作流和业务流程管理平台,以下是主要的XML标签分类:
1. 流程定义相关标签
流程根标签
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:flowable="http://flowable.org/bpmn"
targetNamespace="http://flowable.org/bpmn">
流程元素
<process id="processId" name="流程名称" isExecutable="true">
2. 任务节点标签
用户任务
<userTask
id="userTask1"
name="用户任务"
flowable:assignee="${assignee}"
flowable:candidateUsers="user1,user2"
flowable:candidateGroups="group1,group2">
服务任务
<serviceTask
id="serviceTask1"
name="服务任务"
flowable:class="com.example.MyServiceTask"
flowable:delegateExpression="${myDelegate}"
flowable:expression="${myService.someMethod()}"
flowable:resultVariable="result">
脚本任务
<scriptTask
id="scriptTask1"
scriptFormat="groovy"
flowable:autoStoreVariables="true">
<script>
// 脚本内容
println "Hello Flowable"
</script>
</scriptTask>
手动任务
<manualTask id="manualTask1" name="手动任务"/>
业务规则任务
<businessRuleTask
id="businessRuleTask1"
flowable:ruleVariablesInput="${inputVariables}"
flowable:rules="rule1,rule2"/>
邮件任务
<serviceTask
id="mailTask"
flowable:type="mail">
<extensionElements>
<flowable:field name="to">
<flowable:string>${email}</flowable:string>
</flowable:field>
<flowable:field name="subject">
<flowable:string>邮件主题</flowable:string>
</flowable:field>
</extensionElements>
</serviceTask>
3. 网关标签
排他网关
<exclusiveGateway id="exclusiveGw" name="排他网关"/>
并行网关
<parallelGateway id="parallelGw" name="并行网关"/>
包容网关
<inclusiveGateway id="inclusiveGw" name="包容网关"/>
事件网关
<eventBasedGateway id="eventBasedGw" name="事件网关"/>
4. 事件标签
开始事件
<startEvent id="startEvent1" name="开始">
<!-- 定时器开始事件 -->
<timerEventDefinition>
<timeCycle>0 0 9 * * ?</timeCycle>
</timerEventDefinition>
<!-- 消息开始事件 -->
<messageEventDefinition messageRef="startMessage"/>
<!-- 信号开始事件 -->
<signalEventDefinition signalRef="startSignal"/>
</startEvent>
结束事件
<endEvent id="endEvent1" name="结束">
<!-- 终止结束事件 -->
<terminateEventDefinition/>
<!-- 错误结束事件 -->
<errorEventDefinition errorRef="myError"/>
</endEvent>
中间捕获事件
<intermediateCatchEvent id="catchEvent1">
<!-- 定时器捕获事件 -->
<timerEventDefinition>
<timeDuration>PT5M</timeDuration>
</timerEventDefinition>
<!-- 信号捕获事件 -->
<signalEventDefinition signalRef="alertSignal"/>
</intermediateCatchEvent>
边界事件
<boundaryEvent id="boundaryTimer" cancelActivity="true" attachedToRef="userTask1">
<timerEventDefinition>
<timeDuration>PT1H</timeDuration>
</timerEventDefinition>
</boundaryEvent>
5. 顺序流标签
<sequenceFlow
id="flow1"
sourceRef="startEvent1"
targetRef="userTask1">
<!-- 条件顺序流 -->
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${amount > 1000}]]>
</conditionExpression>
</sequenceFlow>
6. 子流程标签
内嵌子流程
<subProcess id="subProcess1" name="子流程">
<!-- 子流程内部元素 -->
</subProcess>
调用活动
<callActivity
id="callActivity1"
name="调用活动"
calledElement="另一个流程的key">
<extensionElements>
<!-- 变量映射 -->
<flowable:in source="parentVar" target="childVar"/>
<flowable:out source="childResult" target="parentResult"/>
</extensionElements>
</callActivity>
7. 监听器标签
执行监听器
<extensionElements>
<flowable:executionListener
event="start"
class="com.example.MyExecutionListener"
delegateExpression="${executionListenerDelegate}"
expression="${myService.doSomething()}"/>
</extensionElements>
任务监听器
<userTask id="userTask1">
<extensionElements>
<flowable:taskListener
event="create"
class="com.example.MyTaskListener"
delegateExpression="${taskListenerDelegate}">
<flowable:field name="fieldName">
<flowable:string>fieldValue</flowable:string>
</flowable:field>
</flowable:taskListener>
</extensionElements>
</userTask>
8. 扩展属性标签
多实例配置
<userTask id="multiInstanceTask" name="会签任务">
<multiInstanceLoopCharacteristics
isSequential="false"
flowable:collection="assigneeList"
flowable:elementVariable="assignee">
<completionCondition>${nrOfCompletedInstances/nrOfInstances >= 0.6}</completionCondition>
</multiInstanceLoopCharacteristics>
</userTask>
表单属性
<userTask id="formTask">
<extensionElements>
<flowable:formProperty
id="amount"
name="Amount"
type="long"
required="true"
variable="amountVar"/>
</extensionElements>
</userTask>
9. 候选者配置
<userTask id="task1" name="审批任务">
<documentation>任务描述</documentation>
<extensionElements>
<!-- 候选人组 -->
<flowable:candidateGroups>deptLeader,hr</flowable:candidateGroups>
<!-- 候选人用户 -->
<flowable:candidateUsers>user1,user2</flowable:candidateUsers>
<!-- 到期时间 -->
<flowable:dueDate>${createTime.plusDays(3)}</flowable:dueDate>
<!-- 优先级 -->
<flowable:priority>50</flowable:priority>
</extensionElements>
</userTask>
10. 数据对象和变量
<process id="process1">
<!-- 数据对象 -->
<dataObject id="dataObject1" name="申请数据" itemSubjectRef="xsd:string"/>
<!-- 变量定义 -->
<extensionElements>
<flowable:variable name="applicant" type="string"/>
<flowable:variable name="amount" type="long"/>
<flowable:variable name="approved" type="boolean"/>
</extensionElements>
</process>
11. 其他重要标签
泳道(泳道)
<laneSet>
<lane id="lane1" name="销售部门">
<flowNodeRef>task1</flowNodeRef>
<flowNodeRef>task2</flowNodeRef>
</lane>
<lane id="lane2" name="财务部门">
<flowNodeRef>task3</flowNodeRef>
</lane>
</laneSet>
注释
<documentation>
这是流程的说明文档
</documentation>
12. Flowable特定扩展
异步/排他属性
<serviceTask
id="asyncTask"
flowable:async="true"
flowable:exclusive="false"
flowable:failedJobRetryTimeCycle="R3/PT10M"/>
历史级别配置
<process id="process1" flowable:history="full">
跳过表达式
<userTask
id="task1"
flowable:skipExpression="${skipTask}"/>
示例:完整的简单流程
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:flowable="http://flowable.org/bpmn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
targetNamespace="http://flowable.org/bpmn"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath">
<process id="leaveProcess" name="请假流程" isExecutable="true">
<startEvent id="start" name="开始"/>
<sequenceFlow id="flow1" sourceRef="start" targetRef="applyTask"/>
<userTask id="applyTask" name="请假申请" flowable:assignee="${applicant}">
<extensionElements>
<flowable:formProperty id="reason" name="请假原因" type="string" required="true"/>
<flowable:formProperty id="days" name="请假天数" type="long" required="true"/>
</extensionElements>
</userTask>
<sequenceFlow id="flow2" sourceRef="applyTask" targetRef="approveGateway"/>
<exclusiveGateway id="approveGateway" name="审批网关"/>
<sequenceFlow id="flow3" sourceRef="approveGateway" targetRef="leaderApprove">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${days <= 3}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" sourceRef="approveGateway" targetRef="hrApprove">
<conditionExpression xsi:type="tFormalExpression">
<![CDATA[${days > 3}]]>
</conditionExpression>
</sequenceFlow>
<userTask id="leaderApprove" name="领导审批"
flowable:candidateGroups="deptLeader">
<extensionElements>
<flowable:formProperty id="leaderApproved" name="是否批准" type="boolean"/>
</extensionElements>
</userTask>
<userTask id="hrApprove" name="HR审批"
flowable:candidateGroups="hr">
<extensionElements>
<flowable:formProperty id="hrApproved" name="是否批准" type="boolean"/>
</extensionElements>
</userTask>
<sequenceFlow id="flow5" sourceRef="leaderApprove" targetRef="end"/>
<sequenceFlow id="flow6" sourceRef="hrApprove" targetRef="end"/>
<endEvent id="end" name="结束"/>
</process>
</definitions>
这个标签大全涵盖了Flowable BPMN 2.0 XML的主要标签,实际使用时请根据具体需求选择合适的标签和属性。