<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
  xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
  xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
  targetNamespace="urn:getriebe:embedded-parallel-ends">
  <bpmn:resource id="budget-reviewer" name="Budget reviewer" />
  <bpmn:resource id="purchasing-reviewer" name="Purchasing reviewer" />
  <bpmn:resource id="requester" name="Requester" />
  <bpmn:process id="parallelEnds" name="Parallel reviews with independent ends" isExecutable="true">
    <bpmn:startEvent id="submitted" name="Submitted" />
    <bpmn:subProcess id="reviewRound" name="Review round">
      <bpmn:startEvent id="roundStarted" />
      <bpmn:parallelGateway id="splitReviews" gatewayDirection="Diverging" />
      <bpmn:userTask id="checkBudget" name="Check budget">
        <bpmn:potentialOwner><bpmn:resourceRef>budget-reviewer</bpmn:resourceRef></bpmn:potentialOwner>
      </bpmn:userTask>
      <bpmn:userTask id="checkPurchasing" name="Check purchasing">
        <bpmn:potentialOwner><bpmn:resourceRef>purchasing-reviewer</bpmn:resourceRef></bpmn:potentialOwner>
      </bpmn:userTask>
      <bpmn:endEvent id="budgetChecked" name="Budget checked" />
      <bpmn:endEvent id="purchasingChecked" name="Purchasing checked" />
      <bpmn:sequenceFlow id="divideReview" sourceRef="roundStarted" targetRef="splitReviews" />
      <bpmn:sequenceFlow id="startBudget" sourceRef="splitReviews" targetRef="checkBudget" />
      <bpmn:sequenceFlow id="startPurchasing" sourceRef="splitReviews" targetRef="checkPurchasing" />
      <bpmn:sequenceFlow id="finishBudget" sourceRef="checkBudget" targetRef="budgetChecked" />
      <bpmn:sequenceFlow id="finishPurchasing" sourceRef="checkPurchasing" targetRef="purchasingChecked" />
    </bpmn:subProcess>
    <bpmn:userTask id="reviewResult" name="Review result">
      <bpmn:potentialOwner><bpmn:resourceRef>requester</bpmn:resourceRef></bpmn:potentialOwner>
    </bpmn:userTask>
    <bpmn:endEvent id="done" name="Review completed" />
    <bpmn:sequenceFlow id="startRound" sourceRef="submitted" targetRef="reviewRound" />
    <bpmn:sequenceFlow id="showResult" sourceRef="reviewRound" targetRef="reviewResult" />
    <bpmn:sequenceFlow id="finishReview" sourceRef="reviewResult" targetRef="done" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="parallelEndsDiagram">
    <bpmndi:BPMNPlane id="parallelEndsPlane" bpmnElement="parallelEnds">
      <bpmndi:BPMNShape id="submittedShape" bpmnElement="submitted"><dc:Bounds x="48" y="212" width="36" height="36" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="reviewRoundShape" bpmnElement="reviewRound" isExpanded="true"><dc:Bounds x="125" y="105" width="390" height="250" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="roundStartedShape" bpmnElement="roundStarted"><dc:Bounds x="152" y="212" width="36" height="36" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="splitReviewsShape" bpmnElement="splitReviews" isMarkerVisible="true"><dc:Bounds x="220" y="205" width="50" height="50" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="checkBudgetShape" bpmnElement="checkBudget"><dc:Bounds x="303" y="145" width="112" height="59" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="checkPurchasingShape" bpmnElement="checkPurchasing"><dc:Bounds x="303" y="255" width="112" height="59" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="budgetCheckedShape" bpmnElement="budgetChecked"><dc:Bounds x="455" y="157" width="36" height="36" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="purchasingCheckedShape" bpmnElement="purchasingChecked"><dc:Bounds x="455" y="267" width="36" height="36" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="reviewResultShape" bpmnElement="reviewResult"><dc:Bounds x="556" y="198" width="105" height="64" /></bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="doneShape" bpmnElement="done"><dc:Bounds x="703" y="212" width="36" height="36" /></bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="startRoundEdge" bpmnElement="startRound"><di:waypoint x="84" y="230" /><di:waypoint x="125" y="230" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="divideReviewEdge" bpmnElement="divideReview"><di:waypoint x="188" y="230" /><di:waypoint x="220" y="230" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="startBudgetEdge" bpmnElement="startBudget"><di:waypoint x="245" y="205" /><di:waypoint x="245" y="175" /><di:waypoint x="303" y="175" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="startPurchasingEdge" bpmnElement="startPurchasing"><di:waypoint x="245" y="255" /><di:waypoint x="245" y="285" /><di:waypoint x="303" y="285" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="finishBudgetEdge" bpmnElement="finishBudget"><di:waypoint x="415" y="175" /><di:waypoint x="455" y="175" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="finishPurchasingEdge" bpmnElement="finishPurchasing"><di:waypoint x="415" y="285" /><di:waypoint x="455" y="285" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="showResultEdge" bpmnElement="showResult"><di:waypoint x="515" y="230" /><di:waypoint x="556" y="230" /></bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="finishReviewEdge" bpmnElement="finishReview"><di:waypoint x="661" y="230" /><di:waypoint x="703" y="230" /></bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
