我正在设计一个休假请求。假设用户提交带有休假开始日期和结束日期的休假请求。它去了A组团队。该团队可以安排任务。但是如果他们没有安排,如果满足休假结束日期,请求必须结束。所以我在寻找定时器。定时器应该从休假开始日期和结束日期运行。如果假设A组安排任务,它会转到B组。B组只能取消请求(不需要批准)。如果B组取消请求,它会转到A组工作队列。A组可以完成任务结束。如果B组没有取消请求,请求必须结束。请验证我的工作流程。
<?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="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start">
<extensionElements>
<activiti:formProperty id="vacationstartdate" name="Start Date" type="date"
variable="vacationstartdate" datePattern="dd-mm-yyyy" required="true">
<activiti:value id="vacationstartdate" name="Start Date"></activiti:value>
</activiti:formProperty>
<activiti:formProperty id="vacationenddate" name="vacation end date" type="date"
variable="vacationenddate" datePattern="dd-mm-yyyy" required="true">
<activiti:value id="vacationenddate" name="vacationenddate"></activiti:value>
</activiti:formProperty>
</extensionElements>
</startEvent>
<userTask id="usertask1" name="schedule task" activiti:candidateGroups="groupA">
<extensionElements>
<activiti:formProperty id="schdule" name="schduletask" type="enum" required="true">
<activiti:value id="schduletask" name="schduletask"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
<exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
<startEvent id="timerstartevent2" name="Timer start">
<timerEventDefinition></timerEventDefinition>
</startEvent>
<userTask id="usertask2" name="GroupB cancel" activiti:candidateGroups="groupB">
<extensionElements>
<activiti:formProperty id="cancelrequest" name="cancelrequest" type="enum"
variable="cancelrequest">
<activiti:value id="cancelrequest" name="cancelrequest"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
<userTask id="usertask3" name="complete" activiti:candidateGroups="groupA">
<extensionElements>
<activiti:formProperty id="complete" name="complete" type="enum" variable="complete">
<activiti:value id="complete" name="complete"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow5" sourceRef="timerstartevent2" targetRef="exclusivegateway2">
</sequenceFlow>
<sequenceFlow id="flow6" sourceRef="exclusivegateway2" targetRef="usertask2">
</sequenceFlow>
<sequenceFlow id="flow7" sourceRef="usertask2" targetRef="usertask3"></sequenceFlow>
<sequenceFlow id="flow8" sourceRef="exclusivegateway2" targetRef="endevent1">
</sequenceFlow>
<sequenceFlow id="flow10" sourceRef="usertask3" targetRef="endevent1"></sequenceFlow>
<exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow11" name="Request" sourceRef="startevent1" targetRef="usertask1">
</sequenceFlow>
<sequenceFlow id="flow12" sourceRef="usertask1" targetRef="exclusivegateway3">
</sequenceFlow>
<sequenceFlow id="flow13" name="groupA schedule" sourceRef="exclusivegateway3"
targetRef="timerstartevent2"></sequenceFlow>
<startEvent id="timerstartevent3" name="vacation end date">
<timerEventDefinition></timerEventDefinition>
</startEvent>
<sequenceFlow id="flow14" name="groupA does not schedule" sourceRef="exclusivegateway3"
targetRef="timerstartevent3"></sequenceFlow>
<sequenceFlow id="flow15" name="vacation end date met" sourceRef="timerstartevent3"
targetRef="endevent1"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
<bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="40.0" y="210.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55.0" width="105.0" x="140.0" y="200.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
<omgdc:Bounds height="40.0" width="40.0" x="560.0" y="297.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="timerstartevent2" id="BPMNShape_timerstartevent2">
<omgdc:Bounds height="35.0" width="35.0" x="420.0" y="300.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55.0" width="105.0" x="710.0" y="380.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
<omgdc:Bounds height="55.0" width="105.0" x="900.0" y="380.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="1070.0" y="210.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway3" id="BPMNShape_exclusivegateway3">
<omgdc:Bounds height="40.0" width="40.0" x="300.0" y="207.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="timerstartevent3" id="BPMNShape_timerstartevent3">
<omgdc:Bounds height="35.0" width="35.0" x="630.0" y="90.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="455.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="560.0" y="317.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="580.0" y="337.0"></omgdi:waypoint>
<omgdi:waypoint x="580.0" y="407.0"></omgdi:waypoint>
<omgdi:waypoint x="710.0" y="407.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="815.0" y="407.0"></omgdi:waypoint>
<omgdi:waypoint x="900.0" y="407.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
<omgdi:waypoint x="580.0" y="297.0"></omgdi:waypoint>
<omgdi:waypoint x="580.0" y="227.0"></omgdi:waypoint>
<omgdi:waypoint x="1070.0" y="227.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
<omgdi:waypoint x="1005.0" y="407.0"></omgdi:waypoint>
<omgdi:waypoint x="1087.0" y="407.0"></omgdi:waypoint>
<omgdi:waypoint x="1087.0" y="245.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
<omgdi:waypoint x="75.0" y="227.0"></omgdi:waypoint>
<omgdi:waypoint x="140.0" y="227.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="100.0" x="85.0" y="227.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">
<omgdi:waypoint x="245.0" y="227.0"></omgdi:waypoint>
<omgdi:waypoint x="300.0" y="227.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow13" id="BPMNEdge_flow13">
<omgdi:waypoint x="320.0" y="247.0"></omgdi:waypoint>
<omgdi:waypoint x="320.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="420.0" y="317.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="100.0" x="330.0" y="295.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow14" id="BPMNEdge_flow14">
<omgdi:waypoint x="320.0" y="207.0"></omgdi:waypoint>
<omgdi:waypoint x="320.0" y="107.0"></omgdi:waypoint>
<omgdi:waypoint x="630.0" y="107.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="42.0" width="100.0" x="330.0" y="111.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow15" id="BPMNEdge_flow15">
<omgdi:waypoint x="665.0" y="107.0"></omgdi:waypoint>
<omgdi:waypoint x="1087.0" y="107.0"></omgdi:waypoint>
<omgdi:waypoint x="1087.0" y="210.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="42.0" width="100.0" x="675.0" y="107.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
我检查了这个模型,它似乎不正确。我发现了一系列问题:
Flow 13和Flow 14应该设置约束,例如:
您应该在timerstartevent2和timerstartevent3中设置一些时间约束
exexsivegateway2不是必需的
usertask2应该有新的TimerBoundryEvent-如果他们没有完成任务,这将中断groupB的usertask
我做了一个版本,应该或多或少ok;)
<?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="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start">
<extensionElements>
<activiti:formProperty id="vacationstartdate" name="Start Date" type="date" variable="vacationstartdate" datePattern="dd-mm-yyyy" required="true">
<activiti:value id="vacationstartdate" name="Start Date"></activiti:value>
</activiti:formProperty>
<activiti:formProperty id="vacationenddate" name="vacation end date" type="date" variable="vacationenddate" datePattern="dd-mm-yyyy" required="true">
<activiti:value id="vacationenddate" name="vacationenddate"></activiti:value>
</activiti:formProperty>
</extensionElements>
</startEvent>
<userTask id="usertask1" name="schedule task" activiti:candidateGroups="groupA">
<extensionElements>
<activiti:formProperty id="schdule" name="schduletask" type="enum" required="true">
<activiti:value id="schduletask" name="schduletask"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
<startEvent id="timerstartevent2" name="Timer start">
<timerEventDefinition>
<timeDate>scheduleTime</timeDate>
</timerEventDefinition>
</startEvent>
<userTask id="usertask2" name="GroupB cancel" activiti:candidateGroups="groupB">
<extensionElements>
<activiti:formProperty id="cancelrequest" name="cancelrequest" type="enum" variable="cancelrequest">
<activiti:value id="cancelrequest" name="cancelrequest"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
<userTask id="usertask3" name="complete" activiti:candidateGroups="groupA">
<extensionElements>
<activiti:formProperty id="complete" name="complete" type="enum" variable="complete">
<activiti:value id="complete" name="complete"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow5" sourceRef="timerstartevent2" targetRef="usertask2"></sequenceFlow>
<sequenceFlow id="flow7" sourceRef="usertask2" targetRef="usertask3"></sequenceFlow>
<sequenceFlow id="flow10" sourceRef="usertask3" targetRef="endevent1"></sequenceFlow>
<exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow11" name="Request" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
<sequenceFlow id="flow12" sourceRef="usertask1" targetRef="exclusivegateway3"></sequenceFlow>
<sequenceFlow id="flow13" name="groupA schedule" sourceRef="exclusivegateway3" targetRef="timerstartevent2">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${!constraint}]]></conditionExpression>
</sequenceFlow>
<startEvent id="timerstartevent3" name="vacation end date">
<timerEventDefinition>
<timeDate>vacationEndTime</timeDate>
</timerEventDefinition>
</startEvent>
<sequenceFlow id="flow14" name="groupA does not schedule" sourceRef="exclusivegateway3" targetRef="timerstartevent3">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${constraint}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow15" name="vacation end date met" sourceRef="timerstartevent3" targetRef="endevent1"></sequenceFlow>
<boundaryEvent id="boundarytimer1" name="Timer" attachedToRef="usertask2" cancelActivity="true">
<timerEventDefinition></timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="flow16" sourceRef="boundarytimer1" targetRef="endevent1"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
<bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="40.0" y="210.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55.0" width="105.0" x="140.0" y="200.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="timerstartevent2" id="BPMNShape_timerstartevent2">
<omgdc:Bounds height="35.0" width="35.0" x="420.0" y="300.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55.0" width="105.0" x="690.0" y="290.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="boundarytimer1" id="BPMNShape_boundarytimer1">
<omgdc:Bounds height="30.0" width="30.0" x="750.0" y="280.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
<omgdc:Bounds height="55.0" width="105.0" x="890.0" y="290.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="1070.0" y="210.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway3" id="BPMNShape_exclusivegateway3">
<omgdc:Bounds height="40.0" width="40.0" x="300.0" y="207.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="timerstartevent3" id="BPMNShape_timerstartevent3">
<omgdc:Bounds height="35.0" width="35.0" x="630.0" y="90.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="455.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="690.0" y="317.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="795.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="890.0" y="317.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
<omgdi:waypoint x="995.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="1087.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="1087.0" y="245.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
<omgdi:waypoint x="75.0" y="227.0"></omgdi:waypoint>
<omgdi:waypoint x="140.0" y="227.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="40.0" x="85.0" y="227.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">
<omgdi:waypoint x="245.0" y="227.0"></omgdi:waypoint>
<omgdi:waypoint x="300.0" y="227.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow13" id="BPMNEdge_flow13">
<omgdi:waypoint x="320.0" y="247.0"></omgdi:waypoint>
<omgdi:waypoint x="320.0" y="317.0"></omgdi:waypoint>
<omgdi:waypoint x="420.0" y="317.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="14.0" width="100.0" x="330.0" y="295.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow14" id="BPMNEdge_flow14">
<omgdi:waypoint x="320.0" y="207.0"></omgdi:waypoint>
<omgdi:waypoint x="320.0" y="107.0"></omgdi:waypoint>
<omgdi:waypoint x="630.0" y="107.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="42.0" width="100.0" x="330.0" y="111.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow15" id="BPMNEdge_flow15">
<omgdi:waypoint x="665.0" y="107.0"></omgdi:waypoint>
<omgdi:waypoint x="1087.0" y="107.0"></omgdi:waypoint>
<omgdi:waypoint x="1087.0" y="210.0"></omgdi:waypoint>
<bpmndi:BPMNLabel>
<omgdc:Bounds height="42.0" width="100.0" x="675.0" y="107.0"></omgdc:Bounds>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow16" id="BPMNEdge_flow16">
<omgdi:waypoint x="765.0" y="280.0"></omgdi:waypoint>
<omgdi:waypoint x="764.0" y="227.0"></omgdi:waypoint>
<omgdi:waypoint x="1070.0" y="227.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>