其他分享
首页 > 其他分享> > flowable-流程中心设计之网关(八)

flowable-流程中心设计之网关(八)

作者:互联网

简介

网关主要作用是根据条件控制,判断流向,主要分为连线,排他网关,并行网关,兼容网关,事件网关。

连线

说明

连线就是可以设置多条线路,如果有多条连线符合条件,那就选择第一条在流程文件中出现的连线,如果没有符合条件的,就是用默认线路。

设计

 

<?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:flowable="http://flowable.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.flowable.org/processdef">
  <process id="test_signal_5" name="测试信号" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <userTask id="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3" name="经理审核"></userTask>
    <sequenceFlow id="sid-5D67F250-1A29-4E9E-8299-2ADB9048C4AE" sourceRef="startEvent1" targetRef="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3"></sequenceFlow>
    <endEvent id="sid-45845AA4-B21A-4DFB-9D7F-81698B5CB9FE"></endEvent>
    <sequenceFlow id="sid-A12680B5-6B9A-4595-8695-A998A24FE2D5" name="审核不通过" sourceRef="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3" targetRef="sid-45845AA4-B21A-4DFB-9D7F-81698B5CB9FE">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${status='REJECTED'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-23DD057C-3C51-45F7-8E36-300FA378463D" name="审核通过" sourceRef="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3" targetRef="sid-45845AA4-B21A-4DFB-9D7F-81698B5CB9FE">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${status='APPROVED'}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_test_signal_5">
    <bpmndi:BPMNPlane bpmnElement="test_signal_5" id="BPMNPlane_test_signal_5">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="90.0" y="145.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3" id="BPMNShape_sid-01588F55-6BA0-4329-B984-9D40DE6F55B3">
        <omgdc:Bounds height="80.0" width="100.0" x="165.0" y="120.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-45845AA4-B21A-4DFB-9D7F-81698B5CB9FE" id="BPMNShape_sid-45845AA4-B21A-4DFB-9D7F-81698B5CB9FE">
        <omgdc:Bounds height="28.0" width="28.0" x="375.0" y="146.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-A12680B5-6B9A-4595-8695-A998A24FE2D5" id="BPMNEdge_sid-A12680B5-6B9A-4595-8695-A998A24FE2D5">
        <omgdi:waypoint x="215.0" y="199.95"></omgdi:waypoint>
        <omgdi:waypoint x="215.0" y="262.0"></omgdi:waypoint>
        <omgdi:waypoint x="389.0" y="262.0"></omgdi:waypoint>
        <omgdi:waypoint x="389.0" y="173.94993458082106"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-23DD057C-3C51-45F7-8E36-300FA378463D" id="BPMNEdge_sid-23DD057C-3C51-45F7-8E36-300FA378463D">
        <omgdi:waypoint x="264.94999999992666" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="375.0" y="160.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-5D67F250-1A29-4E9E-8299-2ADB9048C4AE" id="BPMNEdge_sid-5D67F250-1A29-4E9E-8299-2ADB9048C4AE">
        <omgdi:waypoint x="119.94999848995758" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="164.9999999999917" y="160.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
View Code

xml 

排他网关

说明

排他网关好像一个人在分岔路口,只会选择一条线路前进,如果有多条连线符合条件,那就选择第一条在流程文件中出现的连线,如果没有符合条件的,就是用默认线路。

设计

 

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:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.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.flowable.org/processdef">
  <process id="test_signal_5" name="测试信号" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <userTask id="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3" name="发起人填表"></userTask>
    <sequenceFlow id="sid-5D67F250-1A29-4E9E-8299-2ADB9048C4AE" sourceRef="startEvent1" targetRef="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3"></sequenceFlow>
    <exclusiveGateway id="sid-3117E275-4C15-4591-9A78-C13B0CB170AB"></exclusiveGateway>
    <sequenceFlow id="sid-9EA97222-7C53-4FC5-B689-5F8EB4D71810" sourceRef="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3" targetRef="sid-3117E275-4C15-4591-9A78-C13B0CB170AB"></sequenceFlow>
    <userTask id="sid-7A94C06C-D003-45A8-911D-58821E2C0240" name="总监审核"></userTask>
    <userTask id="sid-12E10C0A-C46A-4A0B-B388-66A4A0FA75C4" name="经理审核"></userTask>
    <endEvent id="sid-174924A8-DB0B-4DD9-969E-6F44654C1A4A"></endEvent>
    <sequenceFlow id="sid-4BF3EEFB-CF64-4633-9FA2-8180077BC24E" sourceRef="sid-7A94C06C-D003-45A8-911D-58821E2C0240" targetRef="sid-174924A8-DB0B-4DD9-969E-6F44654C1A4A"></sequenceFlow>
    <sequenceFlow id="sid-90D666AA-2CB7-4A9B-9B7A-0DF50C819BCF" sourceRef="sid-12E10C0A-C46A-4A0B-B388-66A4A0FA75C4" targetRef="sid-174924A8-DB0B-4DD9-969E-6F44654C1A4A"></sequenceFlow>
    <sequenceFlow id="sid-F9EAE97D-97FB-4E69-B869-C3AFE740514A" name="金额大于100" sourceRef="sid-3117E275-4C15-4591-9A78-C13B0CB170AB" targetRef="sid-7A94C06C-D003-45A8-911D-58821E2C0240">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${money>100}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="sid-A8BF1219-E2F6-4A08-BC63-9BB5A3B4ACE3" name="金额小于等于100" sourceRef="sid-3117E275-4C15-4591-9A78-C13B0CB170AB" targetRef="sid-12E10C0A-C46A-4A0B-B388-66A4A0FA75C4">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${money<=100}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_test_signal_5">
    <bpmndi:BPMNPlane bpmnElement="test_signal_5" id="BPMNPlane_test_signal_5">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="90.0" y="145.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-01588F55-6BA0-4329-B984-9D40DE6F55B3" id="BPMNShape_sid-01588F55-6BA0-4329-B984-9D40DE6F55B3">
        <omgdc:Bounds height="80.0" width="100.0" x="165.0" y="120.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-3117E275-4C15-4591-9A78-C13B0CB170AB" id="BPMNShape_sid-3117E275-4C15-4591-9A78-C13B0CB170AB">
        <omgdc:Bounds height="40.0" width="40.0" x="310.0" y="140.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-7A94C06C-D003-45A8-911D-58821E2C0240" id="BPMNShape_sid-7A94C06C-D003-45A8-911D-58821E2C0240">
        <omgdc:Bounds height="80.0" width="100.0" x="435.0" y="45.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-12E10C0A-C46A-4A0B-B388-66A4A0FA75C4" id="BPMNShape_sid-12E10C0A-C46A-4A0B-B388-66A4A0FA75C4">
        <omgdc:Bounds height="80.0" width="100.0" x="435.0" y="195.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-174924A8-DB0B-4DD9-969E-6F44654C1A4A" id="BPMNShape_sid-174924A8-DB0B-4DD9-969E-6F44654C1A4A">
        <omgdc:Bounds height="28.0" width="28.0" x="630.0" y="146.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-9EA97222-7C53-4FC5-B689-5F8EB4D71810" id="BPMNEdge_sid-9EA97222-7C53-4FC5-B689-5F8EB4D71810">
        <omgdi:waypoint x="264.9499999999977" y="160.21623376623376"></omgdi:waypoint>
        <omgdi:waypoint x="310.4130434782609" y="160.41304347826087"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-5D67F250-1A29-4E9E-8299-2ADB9048C4AE" id="BPMNEdge_sid-5D67F250-1A29-4E9E-8299-2ADB9048C4AE">
        <omgdi:waypoint x="119.94999848995758" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="164.9999999999917" y="160.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-4BF3EEFB-CF64-4633-9FA2-8180077BC24E" id="BPMNEdge_sid-4BF3EEFB-CF64-4633-9FA2-8180077BC24E">
        <omgdi:waypoint x="534.95" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="644.0" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="644.0" y="146.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-F9EAE97D-97FB-4E69-B869-C3AFE740514A" id="BPMNEdge_sid-F9EAE97D-97FB-4E69-B869-C3AFE740514A">
        <omgdi:waypoint x="330.5" y="140.5"></omgdi:waypoint>
        <omgdi:waypoint x="330.5" y="85.0"></omgdi:waypoint>
        <omgdi:waypoint x="435.0" y="85.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-A8BF1219-E2F6-4A08-BC63-9BB5A3B4ACE3" id="BPMNEdge_sid-A8BF1219-E2F6-4A08-BC63-9BB5A3B4ACE3">
        <omgdi:waypoint x="330.5" y="179.43729892761394"></omgdi:waypoint>
        <omgdi:waypoint x="330.5" y="235.0"></omgdi:waypoint>
        <omgdi:waypoint x="434.9999999999428" y="235.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-90D666AA-2CB7-4A9B-9B7A-0DF50C819BCF" id="BPMNEdge_sid-90D666AA-2CB7-4A9B-9B7A-0DF50C819BCF">
        <omgdi:waypoint x="534.95" y="235.0"></omgdi:waypoint>
        <omgdi:waypoint x="644.0" y="235.0"></omgdi:waypoint>
        <omgdi:waypoint x="644.0" y="173.94994181075484"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
View Code

并行网关

说明

并行网关用于表述流程的并发,并行网关可以让一个执行流变成多个同时进行的并发执行流,也可以让多个执行流合并为一个执行流,因此并行网关会有两种行为,分岔和合并。

设计

发起人填表后,3条线上传附件,然后汇集一起提交

 

包含网关

说明

兼容网关就好像排他网关和并行网关的结合体,与排他网关不同的是,兼容网关可以创建多条执行流,

换言之,如果多个条件成立,那么此时可以将它看做并行网关,而排他网关,多个条件成立时,只会选择第一个定义的顺序流。

设计

 

事件网关

说明

网关的每个外出顺序流都要连接到一个中间捕获事件

设计

 

标签:网关,连线,flowable,流程,并行,多条,设计,符合条件
来源: https://www.cnblogs.com/LQBlog/p/15821996.html