cancel
Showing results for 
Search instead for 
Did you mean: 

In parallelGateway how to delete userTask?

yunlielai
Champ in-the-making
Champ in-the-making
<?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" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="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="TwoMultiInstance" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="11111"></userTask>
    <userTask id="usertask2" name="2222" activiti:assignee="${countersignUser1}">
     <extensionElements>
        <activiti:taskListener event="complete" class="TaskListener.TwoMultiInstanceCreateListener1"></activiti:taskListener>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${countersignUser1s}" activiti:elementVariable="countersignUser1">
        <completionCondition>${nrOfCompletedInstances/nrOfInstances >= 1 }</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <userTask id="usertask3" name="33333" activiti:assignee="${countersignUser2}">
     <extensionElements>
        <activiti:taskListener event="complete" class="TaskListener.TwoMultiInstanceCreateListener2"></activiti:taskListener>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${countersignUser2s}" activiti:elementVariable="countersignUser2">
        <completionCondition>${nrOfCompletedInstances/nrOfInstances >= 1 }</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <userTask id="usertask4" name="4445444"></userTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway>
    <parallelGateway id="parallelgateway2" name="Parallel Gateway"></parallelGateway>
    <sequenceFlow id="flow3" sourceRef="usertask1" targetRef="parallelgateway1"></sequenceFlow>
    <sequenceFlow id="flow4" sourceRef="parallelgateway1" targetRef="usertask2"></sequenceFlow>
    <sequenceFlow id="flow5" sourceRef="usertask2" targetRef="parallelgateway2"></sequenceFlow>
    <sequenceFlow id="flow6" sourceRef="parallelgateway2" targetRef="usertask4"></sequenceFlow>
    <sequenceFlow id="flow7" sourceRef="parallelgateway1" targetRef="usertask3"></sequenceFlow>
    <sequenceFlow id="flow8" sourceRef="usertask3" targetRef="parallelgateway2"></sequenceFlow>
    <sequenceFlow id="flow9" sourceRef="usertask4" 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="140.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="300.0" y="200.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
        <omgdc:Bounds height="55.0" width="105.0" x="590.0" y="120.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
        <omgdc:Bounds height="55.0" width="105.0" x="600.0" y="264.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask4" id="BPMNShape_usertask4">
        <omgdc:Bounds height="55.0" width="105.0" x="830.0" y="193.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="1010.0" y="203.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="parallelgateway1" id="BPMNShape_parallelgateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="530.0" y="207.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="parallelgateway2" id="BPMNShape_parallelgateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="740.0" y="200.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="175.0" y="227.0"></omgdi:waypoint>
        <omgdi:waypoint x="300.0" y="227.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="405.0" y="227.0"></omgdi:waypoint>
        <omgdi:waypoint x="530.0" y="227.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="550.0" y="207.0"></omgdi:waypoint>
        <omgdi:waypoint x="550.0" y="147.0"></omgdi:waypoint>
        <omgdi:waypoint x="590.0" y="147.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="695.0" y="147.0"></omgdi:waypoint>
        <omgdi:waypoint x="760.0" y="147.0"></omgdi:waypoint>
        <omgdi:waypoint x="760.0" y="200.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="780.0" y="220.0"></omgdi:waypoint>
        <omgdi:waypoint x="830.0" y="220.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="550.0" y="247.0"></omgdi:waypoint>
        <omgdi:waypoint x="550.0" y="291.0"></omgdi:waypoint>
        <omgdi:waypoint x="600.0" y="291.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="705.0" y="291.0"></omgdi:waypoint>
        <omgdi:waypoint x="760.0" y="291.0"></omgdi:waypoint>
        <omgdi:waypoint x="760.0" y="240.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="935.0" y="220.0"></omgdi:waypoint>
        <omgdi:waypoint x="1010.0" y="220.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

My English isn't good!!

In this workFlow  , two UserTaskes  inside the parallelGateway and they have  many people  to countersign! Only  one of they to  be completed  which to be countersigned  and the wrokFlow will be  going on!
What can i do?

3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Im not understanding it fully … but do you want to continue the process when only *one* person has signed?

You would need something like this, no?
<code>
<completionCondition>${nrOfCompletedInstances == 1 }</completionCondition>
</code>
Whoch is what you did … so sorry, I don't get your question Smiley Tongue

yunlielai
Champ in-the-making
Champ in-the-making
I'm sorry,i don't fully describe to my  question!   I described again:
In this workFlow , two UserTaskes inside the parallelGateway and they have many people to countersign! Only one of they to be completed which to be countersigned and the wrokFlow will be going on!
What can i do? 
for example:First When I complete to the UserTask which name is '11111'.Second,the process go into the  parallelGateway  which hava two UserTasks that their name is '2222' or '3333'.Threed ,After completing to the UserTask which name is '2222',and not thinking about another usertask which name is '3333. At last, the process will go to the  UserTask  which name is '4444'!

The best to you!!  Tk
<process id="TwoMultiInstance" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="11111"></userTask>
    <userTask id="usertask2" name="2222" activiti:assignee="${countersignUser1}">
      <extensionElements>
        <activiti:taskListener event="complete" class="TaskListener.TwoMultiInstanceCreateListener1"></activiti:taskListener>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${countersignUser1s}" activiti:elementVariable="countersignUser1">
        <completionCondition>${nrOfCompletedInstances/nrOfInstances >1 }</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <userTask id="usertask3" name="3333" activiti:assignee="${countersignUser2}">
      <extensionElements>
        <activiti:taskListener event="complete" class="TaskListener.TwoMultiInstanceCreateListener2"></activiti:taskListener>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${countersignUser2s}" activiti:elementVariable="countersignUser2">
        <completionCondition>${nrOfCompletedInstances/nrOfInstances>1 }</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <userTask id="usertask4" name="44444"></userTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway>
    <parallelGateway id="parallelgateway2" name="Parallel Gateway"></parallelGateway>
    <sequenceFlow id="flow3" sourceRef="usertask1" targetRef="parallelgateway1"></sequenceFlow>
    <sequenceFlow id="flow4" sourceRef="parallelgateway1" targetRef="usertask2"></sequenceFlow>
    <sequenceFlow id="flow6" sourceRef="parallelgateway2" targetRef="usertask4"></sequenceFlow>
    <sequenceFlow id="flow7" sourceRef="parallelgateway1" targetRef="usertask3"></sequenceFlow>
    <sequenceFlow id="flow9" sourceRef="usertask4" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow10" sourceRef="usertask2" targetRef="parallelgateway2"></sequenceFlow>
    <sequenceFlow id="flow11" sourceRef="usertask3" targetRef="parallelgateway2"></sequenceFlow>
  </process>

frederikherema1
Star Contributor
Star Contributor
Just to get it right, from what I understand of your usecase:
- You have a parallel gate-way with 2 user-tasks. These user-tasks serve a different purpose.
- One of the user tasks is a multi-instance, assigned to one group of people, which can "countersign" the task by completing it.
- The other user task is a multi-instance assigned to another group of people, which can "countersign" the task by completing it.
- If one of the 2 tasks is completed, the other task should be cancelled and the workflow should be completed.

A solution I can suggest is surrounding the parallel fork-gateway, the 2 user-tasks and the join-gateway by a sub-process. Add a signal-boundary-event on the sub-process, with cancelActivity="true". From the 2 user-tasks in the subprocess, you'll add 2 intermediate signal throwing events (each task has a sequence-flow to one throwing-event). When one of the two user-tasks completes, a signal will be thrown an caught by the boundary-event, canceling the sub-process and removing any open tasks in that.

Your process moves on, starting from an outgoing flow on the boundary-event.