Activiti工作流使用之新建bpmn文件
一、bpmn文件介绍
业务流程建模与标注(Business Process Model and Notation,BPMN) ,描述流程的基本符号,包括这些图元如何组合成一个业务流程图(Business Process Diagram)
idea画出流程,有两个文件bpmn文件和png文件,其中bpmn文件又可以叫做流程定义文件,它需要遵循BPMN语言规范.png:就是一个单纯的图片,没有任何作用.
二、流程绘制
2.1 使用activiti-app绘制流程
流程实例:积分审批流程
2.2 流程节点指定代理人
每一个流程节点需要指定一个代理人,即流程执行到某个任务,需要有指定的用户来进行审批
点击任务节点,选择代理人
指定代理人的方式一共有三种:
1、固定代理人
2、使用url表达式动态设置代理人
3、使用监听器动态设置代理人
2.3 除了代理人,节点还可以设置其他类型节点审核
后续文章进行讲解
三、流程保存与导出
保存:
导出:
四、流程bpmn文件
<?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:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef"> <process id="pointsRequestProcesses" name="积分审批流程" isExecutable="true"> <startEvent id="startEventPoint" name="开始" /> <userTask id="userTaskPointsRequest" name="积分申请" activiti:assignee="${applicantUser}" activiti:exclusive="true"> <outgoing>Flow_0z08cw6</outgoing> </userTask> <userTask id="userTaskCompanyApproval" name="省公司审批" activiti:candidateUsers="${reviewerUser}" activiti:exclusive="true"> <incoming>Flow_0z08cw6</incoming> </userTask> <exclusiveGateway id="exclusivegateway02" name="省公司审批exclusivegateway02" /> <endEvent id="endEventPoint" /> <sequenceFlow id="flow1" sourceRef="startEventPoint" targetRef="userTaskPointsRequest" /> <sequenceFlow id="flow4" sourceRef="userTaskCompanyApproval" targetRef="exclusivegateway02" /> <sequenceFlow id="flowrightexclusivegateway2" name="省公司审批通过" sourceRef="exclusivegateway02" targetRef="endEventPoint"> <extensionElements> <activiti:executionListener class="com.awifi.capacity.project.manager.activiti.provider.listener.MyTaskListener" event="take" /> </extensionElements> <conditionExpression xsi:type="tFormalExpression"> ${isOk == true} </conditionExpression> </sequenceFlow> <sequenceFlow id="flowleftexclusivegateway2" name="省公司审批未通过" sourceRef="exclusivegateway02" targetRef="userTaskPointsRequest"> <extensionElements> <activiti:executionListener class="com.awifi.capacity.project.manager.activiti.provider.listener.MyTaskListener" event="take" /> </extensionElements> <conditionExpression xsi:type="tFormalExpression"> ${isOk == false} </conditionExpression> </sequenceFlow> <sequenceFlow id="Flow_0z08cw6" sourceRef="userTaskPointsRequest" targetRef="userTaskCompanyApproval" /> </process> <bpmndi:BPMNDiagram id="BPMNDiagram_pointsRequest"> <bpmndi:BPMNPlane id="BPMNPlane_pointsRequest" bpmnElement="pointsRequestProcesses"> <bpmndi:BPMNEdge id="BPMNEdge_flowleftexclusivegateway2" bpmnElement="flowleftexclusivegateway2"> <omgdi:waypoint x="769.402004454343" y="69.40200445434299" /> <omgdi:waypoint x="383.75" y="162.88046485888214" /> <bpmndi:BPMNLabel> <omgdc:Bounds x="533" y="91" width="88" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_flowrightexclusivegateway2" bpmnElement="flowrightexclusivegateway2"> <omgdi:waypoint x="798.9766063630692" y="71.02339363693075" /> <omgdi:waypoint x="1056.795793598862" y="176.69071224016682" /> <bpmndi:BPMNLabel> <omgdc:Bounds x="889" y="99" width="77" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_flow4" bpmnElement="flow4"> <omgdi:waypoint x="785" y="135" /> <omgdi:waypoint x="785" y="85" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_flow1" bpmnElement="flow1"> <omgdi:waypoint x="189.99732231181528" y="177.7165860350523" /> <omgdi:waypoint x="283.75" y="175.9448818897638" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0z08cw6_di" bpmnElement="Flow_0z08cw6"> <omgdi:waypoint x="384" y="175" /> <omgdi:waypoint x="735" y="175" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_startEvent1" bpmnElement="startEventPoint"> <omgdc:Bounds x="160" y="163" width="30" height="30" /> <bpmndi:BPMNLabel> <omgdc:Bounds x="164" y="193" width="22" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_userTask1" bpmnElement="userTaskPointsRequest"> <omgdc:Bounds x="284" y="135" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_userTask3" bpmnElement="userTaskCompanyApproval"> <omgdc:Bounds x="735" y="135" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_exclusivegateway02" bpmnElement="exclusivegateway02" isMarkerVisible="true"> <omgdc:Bounds x="765" y="45" width="40" height="40" /> <bpmndi:BPMNLabel> <omgdc:Bounds x="742" y="85" width="86" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_sid-5477B73E-9754-4A01-B13D-B6B61CC509E0" bpmnElement="endEventPoint"> <omgdc:Bounds x="1056" y="168" width="28" height="28" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>