AnsweredAssumed Answered

Multiple End or Start events

Question asked by yangyang.qian on Dec 24, 2010
Latest reply on Dec 27, 2010 by yangyang.qian
Can the Activiti engine handle multiple end events?

Say I have a process like the following …

Start –> task1  –> XOR  –> End1
…………………….|__> End2

where End1 vs End2 has some sort of business meaning (i.e. rejected vs approved)

If I were to execute this process, would the engine differentiate between the two end events, and would I be able to tell where it ended as a client of the engine?



Or, is this supposed to be the ideal usage …

Start –> task1  –> XOR  –> servicetask+CustomBehavior1 —-> End
……………………..|__> servicetask+CustomBehavior2 _________^



( I was playing around with the Activiti Designer and noticed that if the diagram had two end events in it … and it only seems to write end1 into the xml. I was hoping this was just a diagram translation issue …)


Thanks in advance!


PS: could also be that I just installed my Designer plugin wrong and now it's getting its revenge on me … is anyone getting this issue?

here's the contents acitiviti designer file I was playing around with … (don't know why I'm not allowed to attach the file directly) … hopefully this can be copy-pasted into another activiti file for duplication.


<?xml version="1.0" encoding="ASCII"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms">
  <pi:Diagram visible="true" gridUnit="10" diagramTypeId="BPMNdiagram" name="multiends" snapToGrid="true" showGuides="true" pictogramLinks="/0/@children.0/@link /0/@children.0/@children.0/@link /0/@children.1/@link /0/@children.1/@children.0/@link /0/@children.2/@link /0/@children.2/@children.0/@link /0/@children.3/@link /0/@children.3/@children.0/@link /0/@connections.0/@link /0/@children.4/@link /0/@connections.1/@link /0/@connections.2/@link /0/@connections.3/@link">
    <graphicsAlgorithm xsi:type="al:Rectangle" background="/0/@colors.1" foreground="/0/@colors.0" width="1000" height="1000"/>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false" width="55" height="55" x="362" y="150">
        <graphicsAlgorithmChildren xsi:type="al:Ellipse" width="55" height="55" style="/0/@styles.0"/>
      </graphicsAlgorithm>
      <link businessObjects="startevent1"/>
      <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="/0/@connections.0"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.0/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="1.0" relativeHeight="0.51">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Text" width="55" height="55" style="/0/@styles.1" horizontalAlignment="ALIGNMENT_CENTER" value="Start">
          <font name="Arial" size="8" bold="true"/>
        </graphicsAlgorithm>
        <link businessObjects="startevent1"/>
      </children>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false" width="55" height="55" x="283" y="430">
        <graphicsAlgorithmChildren xsi:type="al:Ellipse" width="55" height="55" style="/0/@styles.0"/>
      </graphicsAlgorithm>
      <link businessObjects="endevent1"/>
      <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="/0/@connections.2"/>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Text" width="55" height="55" style="/0/@styles.2" horizontalAlignment="ALIGNMENT_CENTER" value="End1">
          <font name="Arial" size="8" bold="true"/>
        </graphicsAlgorithm>
        <link businessObjects="endevent1"/>
      </children>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false" width="55" height="55" x="430" y="430">
        <graphicsAlgorithmChildren xsi:type="al:Ellipse" width="55" height="55" style="/0/@styles.0"/>
      </graphicsAlgorithm>
      <link businessObjects="endevent2"/>
      <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="/0/@connections.3"/>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Text" width="55" height="55" style="/0/@styles.3" horizontalAlignment="ALIGNMENT_CENTER" value="End2">
          <font name="Arial" size="8" bold="true"/>
        </graphicsAlgorithm>
        <link businessObjects="endevent2"/>
      </children>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Rectangle" filled="false" lineVisible="false" width="105" height="55" x="337" y="240">
        <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" width="105" height="55" style="/0/@styles.0" cornerHeight="5" cornerWidth="5"/>
      </graphicsAlgorithm>
      <link businessObjects="usertask7"/>
      <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="/0/@connections.1" incomingConnections="/0/@connections.0"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.3/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="1.0" relativeHeight="0.51">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Text" width="105" height="20" y="20" style="/0/@styles.5" horizontalAlignment="ALIGNMENT_CENTER" value="myTask">
          <font name="Arial" size="8" bold="true"/>
        </graphicsAlgorithm>
        <link businessObjects="usertask7"/>
      </children>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Image" width="16" height="16" x="5" y="5" id="org.activiti.designer.usertask" stretchH="false" stretchV="false" proportional="false"/>
      </children>
    </children>
    <children xsi:type="pi:ContainerShape" visible="true" active="true">
      <graphicsAlgorithm xsi:type="al:Polygon" filled="false" lineVisible="false" width="60" height="60" x="359" y="330">
        <graphicsAlgorithmChildren xsi:type="al:Polygon" width="60" height="60" style="/0/@styles.0">
          <points y="30"/>
          <points x="30"/>
          <points x="60" y="30"/>
          <points x="30" y="60"/>
          <points y="30"/>
        </graphicsAlgorithmChildren>
        <points y="30"/>
        <points x="30"/>
        <points x="60" y="30"/>
        <points x="30" y="60"/>
        <points y="30"/>
      </graphicsAlgorithm>
      <link businessObjects="exclusivegateway7"/>
      <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="/0/@connections.2 /0/@connections.3" incomingConnections="/0/@connections.1"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.4/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="0.51" relativeHeight="0.1">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <anchors xsi:type="pi:ChopboxAnchor"/>
      <anchors xsi:type="pi:BoxRelativeAnchor" visible="true" active="true" referencedGraphicsAlgorithm="/0/@children.4/@graphicsAlgorithm/@graphicsAlgorithmChildren.0" relativeWidth="0.51" relativeHeight="0.93">
        <graphicsAlgorithm xsi:type="al:Ellipse" filled="false" lineVisible="false"/>
      </anchors>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Polyline" lineWidth="7" filled="false" style="/0/@styles.0">
          <points x="45" y="15"/>
          <points x="15" y="45"/>
        </graphicsAlgorithm>
      </children>
      <children visible="true">
        <graphicsAlgorithm xsi:type="al:Polyline" lineWidth="7" filled="false" style="/0/@styles.0">
          <points x="15" y="15"/>
          <points x="45" y="45"/>
        </graphicsAlgorithm>
      </children>
    </children>
    <styles foreground="/0/@colors.2" lineWidth="2" id="BPMN-CLASS">
      <renderingStyle>
        <adaptedGradientColoredAreas definedStyleId="blue-white-gloss" gradientType="0">
          <adaptedGradientColoredAreas styleAdaption="0">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="248" green="251" blue="254"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="1">
                <color red="248" green="251" blue="254"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="1">
                <color red="237" green="245" blue="252"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="2">
                <color red="237" green="245" blue="252"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="2">
                <color red="222" green="237" blue="250"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="3">
                <color red="222" green="237" blue="250"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="3">
                <color red="212" green="231" blue="248"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="2">
                <color red="250" green="251" blue="252"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="2">
                <color red="226" green="229" blue="233"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="226" green="229" blue="233"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
          <adaptedGradientColoredAreas styleAdaption="1">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="238" green="246" blue="253"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="1">
                <color red="238" green="246" blue="253"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="1">
                <color red="208" green="230" blue="249"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="2">
                <color red="208" green="230" blue="249"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="2">
                <color red="172" green="210" blue="244"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="3">
                <color red="172" green="210" blue="244"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="3">
                <color red="129" green="185" blue="234"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="2">
                <color red="170" green="208" blue="242"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="2">
                <color red="154" green="191" blue="224"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="154" green="191" blue="224"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
          <adaptedGradientColoredAreas styleAdaption="2">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="245" green="249" blue="254"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="1">
                <color red="245" green="249" blue="254"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="1">
                <color red="226" green="239" blue="252"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="2">
                <color red="226" green="239" blue="252"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="2">
                <color red="203" green="227" blue="249"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="3">
                <color red="203" green="227" blue="249"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="3">
                <color red="187" green="218" blue="247"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="2">
                <color red="197" green="224" blue="247"/>
              </end>
            </gradientColor>
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="2">
                <color red="178" green="205" blue="229"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="178" green="205" blue="229"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
          <adaptedGradientColoredAreas styleAdaption="3">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="153" green="204"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="51" green="153" blue="102"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
          <adaptedGradientColoredAreas styleAdaption="4">
            <gradientColor>
              <start locationType="LOCATION_TYPE_ABSOLUTE_START" locationValue="0">
                <color red="255" green="204"/>
              </start>
              <end locationType="LOCATION_TYPE_ABSOLUTE_END" locationValue="0">
                <color red="255" green="102"/>
              </end>
            </gradientColor>
          </adaptedGradientColoredAreas>
        </adaptedGradientColoredAreas>
      </renderingStyle>
    </styles>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <styles background="/0/@colors.4" foreground="/0/@colors.4" id="BPMN-POLYGON-ARROW"/>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <styles foreground="/0/@colors.3" id="BPMNCLASS-TEXT"/>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.0/@anchors.0" end="/0/@children.3/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.4" filled="false"/>
      <link businessObjects="flow33"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" x="10" style="/0/@styles.6" value="">
          <font name="Arial" size="8"/>
        </graphicsAlgorithm>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" style="/0/@styles.7">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
    </connections>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.3/@anchors.0" end="/0/@children.4/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.4" filled="false"/>
      <link businessObjects="flow34"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" x="10" style="/0/@styles.8" value="">
          <font name="Arial" size="8"/>
        </graphicsAlgorithm>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" style="/0/@styles.7">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
    </connections>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.4/@anchors.0" end="/0/@children.1/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.4" filled="false"/>
      <link businessObjects="flow35"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" x="10" style="/0/@styles.9" value="to1">
          <font name="Arial" size="8"/>
        </graphicsAlgorithm>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" style="/0/@styles.7">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
    </connections>
    <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="/0/@children.4/@anchors.0" end="/0/@children.2/@anchors.0">
      <graphicsAlgorithm xsi:type="al:Polyline" foreground="/0/@colors.4" filled="false"/>
      <link businessObjects="flow36"/>
      <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
        <graphicsAlgorithm xsi:type="al:Text" x="10" style="/0/@styles.10" value="to2">
          <font name="Arial" size="8"/>
        </graphicsAlgorithm>
      </connectionDecorators>
      <connectionDecorators visible="true" locationRelative="true" location="1.0">
        <graphicsAlgorithm xsi:type="al:Polygon" style="/0/@styles.7">
          <points x="-10" y="-5" before="3" after="3"/>
          <points/>
          <points x="-10" y="5" before="3" after="3"/>
          <points x="-8" before="3" after="3"/>
        </graphicsAlgorithm>
      </connectionDecorators>
    </connections>
    <colors red="227" green="238" blue="249"/>
    <colors red="255" green="255" blue="255"/>
    <colors red="25" green="25" blue="112"/>
    <colors red="51" green="51" blue="153"/>
    <colors/>
  </pi:Diagram>
  <bpmn2:Process id="helloworld" name="helloworld">
    <documentation id="documentation_process" text=""/>
  </bpmn2:Process>
  <bpmn2:StartEvent id="startevent1" name="Start" outgoing="flow33"/>
  <bpmn2:EndEvent id="endevent1" name="End1" incoming="flow35"/>
  <bpmn2:EndEvent id="endevent2" name="End2" incoming="flow36"/>
  <bpmn2:UserTask id="usertask7" name="myTask" incoming="flow33" outgoing="flow34" assignee="YYQ" formKey=""/>
  <bpmn2:SequenceFlow id="flow33" name="" sourceRef="startevent1" targetRef="usertask7"/>
  <bpmn2:ExclusiveGateway id="exclusivegateway7" name="Exclusive Gateway" incoming="flow34" outgoing="flow35 flow36"/>
  <bpmn2:SequenceFlow id="flow34" name="" sourceRef="usertask7" targetRef="exclusivegateway7"/>
  <bpmn2:SequenceFlow id="flow35" name="to1" sourceRef="exclusivegateway7" targetRef="endevent1">
    <conditionExpression id="flow35_condition" body="${foo == 1}"/>
  </bpmn2:SequenceFlow>
  <bpmn2:SequenceFlow id="flow36" name="to2" sourceRef="exclusivegateway7" targetRef="endevent2">
    <conditionExpression id="flow36_condition" body="${foo != 1}"/>
  </bpmn2:SequenceFlow>
</xmi:XMI>

Outcomes