activiti之排他网关,流程变量
来源:互联网 发布:海康视频服务器软件 编辑:程序博客网 时间:2024/06/06 02:57
利用junit4测试
1. 部署流程模版
@Test @Deployment(resources="diagrams/troubleHoliday.bpmn") public void deployTroubleHoliday(){ org.activiti.engine.repository.Deployment deployment = engine.getRepositoryService().createDeployment().addClasspathResource("diagrams/troubleHoliday.bpmn").deploy(); }
- 启动流程
@Test @Deployment(resources="diagrams/troubleHoliday.bpmn") public void startProcess(){ Map<String, Object> variables = new HashMap<String, Object>(); variables.put("userId", "1"); ProcessInstance instance = engine.getRuntimeService().startProcessInstanceByKey("troubleHoliday",variables); }
- 下一步排他网关过滤条件
@Test @Deployment(resources="diagrams/troubleHoliday.bpmn") public void panDuan(){ Task task = engine.getTaskService().createTaskQuery().processInstanceId("167501").active().singleResult(); Map<String, Object> variables = new HashMap<String, Object>(); variables.put("days", 0.5);//条件 variables.put("projectGroup", "12");//指定项目组长 engine.getTaskService().complete(task.getId(),variables); Task task2 = engine.getTaskService().createTaskQuery().processInstanceId("167501").active().singleResult(); engine.getTaskService().claim(task2.getId(), "2");//签收,用于指定下一步由谁来办理(只针对于candidateUsers和candidateGroups属性) }
每一步对应act_ru_task(执行中的任务)
、act_re_deployment(已部署的流程模版)
和act_ru_variable(模版中的变量赋值情况)
查看记录。
该配置文件详细
<?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" 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/test"> <process id="troubleHoliday" name="startHoliday" isExecutable="true"> <startEvent id="startevent1" name="Start"></startEvent> <userTask id="submit" name="提交请假申请" activiti:assignee="#{userId}"> <documentation>提交请假申请</documentation> </userTask> <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="submit"></sequenceFlow> <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway" default="flow11"></exclusiveGateway> <sequenceFlow id="flow2" sourceRef="submit" targetRef="exclusivegateway1"></sequenceFlow> <userTask id="usertask1" name="【项目组长】审核" activiti:candidateUsers="#{projectGroup}"> <documentation>项目组长审核</documentation> </userTask> <sequenceFlow id="flow3" name="${days<=0.5}" sourceRef="exclusivegateway1" targetRef="usertask1"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${days<=0.5}]]></conditionExpression> </sequenceFlow> <userTask id="usertask2" name="【总经理】审核" activiti:candidateUsers="#{lead}"> <documentation>总经理审核</documentation> </userTask> <sequenceFlow id="flow4" name="${days>1}" sourceRef="exclusivegateway1" targetRef="usertask2"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${days>1}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="flow5" name="同意" sourceRef="usertask1" targetRef="usertask2"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${action=='同意'}]]></conditionExpression> </sequenceFlow> <userTask id="usertask3" name="【项目经理】审核" activiti:candidateUsers="#{leadGroup}"> <documentation>项目经理审核</documentation> </userTask> <sequenceFlow id="flow6" name="${days>0.5 && days<=1}" sourceRef="exclusivegateway1" targetRef="usertask3"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${days>0.5 && days<=1}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="flow7" name="同意" sourceRef="usertask3" targetRef="usertask2"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${action=='同意'}]]></conditionExpression> </sequenceFlow> <endEvent id="endevent1" name="End"></endEvent> <sequenceFlow id="flow8" name="同意" sourceRef="usertask2" targetRef="endevent1"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${action=='同意'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="flow9" name="驳回" sourceRef="usertask2" targetRef="submit"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${action=='驳回'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="flow10" name="驳回" sourceRef="usertask1" targetRef="submit"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${action=='驳回'}]]></conditionExpression> </sequenceFlow> <sequenceFlow id="flow11" name="驳回" sourceRef="usertask3" targetRef="submit"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${action=='驳回'}]]></conditionExpression> </sequenceFlow> </process> <bpmndi:BPMNDiagram id="BPMNDiagram_troubleHoliday"> <bpmndi:BPMNPlane bpmnElement="troubleHoliday" id="BPMNPlane_troubleHoliday"> <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1"> <omgdc:Bounds height="35.0" width="35.0" x="20.0" y="319.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="submit" id="BPMNShape_submit"> <omgdc:Bounds height="55.0" width="105.0" x="100.0" y="309.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1"> <omgdc:Bounds height="35.0" width="35.0" x="700.0" y="319.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1"> <omgdc:Bounds height="40.0" width="40.0" x="260.0" y="316.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1"> <omgdc:Bounds height="55.0" width="105.0" x="370.0" y="200.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2"> <omgdc:Bounds height="55.0" width="105.0" x="540.0" y="309.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3"> <omgdc:Bounds height="55.0" width="105.0" x="380.0" y="430.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> <omgdi:waypoint x="55.0" y="336.0"></omgdi:waypoint> <omgdi:waypoint x="100.0" y="336.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"> <omgdi:waypoint x="205.0" y="336.0"></omgdi:waypoint> <omgdi:waypoint x="260.0" y="336.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6"> <omgdi:waypoint x="280.0" y="356.0"></omgdi:waypoint> <omgdi:waypoint x="432.0" y="430.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="42.0" width="100.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7"> <omgdi:waypoint x="432.0" y="430.0"></omgdi:waypoint> <omgdi:waypoint x="592.0" y="364.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="24.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8"> <omgdi:waypoint x="645.0" y="336.0"></omgdi:waypoint> <omgdi:waypoint x="700.0" y="336.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="24.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9"> <omgdi:waypoint x="592.0" y="309.0"></omgdi:waypoint> <omgdi:waypoint x="592.0" y="192.0"></omgdi:waypoint> <omgdi:waypoint x="152.0" y="194.0"></omgdi:waypoint> <omgdi:waypoint x="152.0" y="309.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="24.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10"> <omgdi:waypoint x="370.0" y="227.0"></omgdi:waypoint> <omgdi:waypoint x="152.0" y="227.0"></omgdi:waypoint> <omgdi:waypoint x="152.0" y="309.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="24.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11"> <omgdi:waypoint x="380.0" y="457.0"></omgdi:waypoint> <omgdi:waypoint x="152.0" y="457.0"></omgdi:waypoint> <omgdi:waypoint x="152.0" y="364.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="24.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3"> <omgdi:waypoint x="280.0" y="316.0"></omgdi:waypoint> <omgdi:waypoint x="422.0" y="255.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="65.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4"> <omgdi:waypoint x="300.0" y="336.0"></omgdi:waypoint> <omgdi:waypoint x="540.0" y="336.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="50.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5"> <omgdi:waypoint x="422.0" y="255.0"></omgdi:waypoint> <omgdi:waypoint x="592.0" y="309.0"></omgdi:waypoint> <bpmndi:BPMNLabel> <omgdc:Bounds height="14.0" width="100.0" x="10.0" y="0.0"></omgdc:Bounds> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram></definitions>
0 0
- activiti之排他网关,流程变量
- Activiti排他网关
- Activiti Designer实现排他网关
- activiti学习--09 排他网关
- Activiti基础教程--09排他网关,并行网关
- Activiti基础教程--09排他网关,并行网关
- Activiti的排他网关、并行网关、
- activiti之流程变量
- activiti之流程变量
- activiti实战系列 排他网关(ExclusiveGateWay)
- Activiti进阶七-----排他网关(ExclusiveGateway)
- activiti 快速入门--排他网关(3)
- 9.activiti工作流-排他网关(ExclusiveGateWay)
- 工作流框架--activiti(四)--排他网关和并行网关
- Activiti进阶(七)——排他网关(ExclusiveGateWay)
- Activiti(七)——排他网关(ExclusiveGateWay)
- Activiti 学习笔记八:排他网关(ExclusiveGateWay)
- Activiti进阶(七)——排他网关(ExclusiveGateWay)
- iptables 里 recent 模块的用法
- HashMap实现原理
- HBase 客户端通过Java访问集群
- 第一篇博客
- [2016/11/28]判断一个数是否是回文数,但不能开多余空间
- activiti之排他网关,流程变量
- Hibernate中一对多关联关系保存
- 脚踏实地,一步一步地解决问题
- String literal is not properly closed by a double-quote
- 玩转Android之数据库框架greenDAO3.0使用指南
- 去除 input 点击时出现的蓝边框
- strstr函数的用法
- 程序调用系统拍照返回后崩溃的问题
- SAP 库存物资收发存报表主要思路