<?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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="definitions" name="Registering incoming letters" targetNamespace="http://bpmn.io/schema/bpmn" exporter="tok" exporterVersion="1.0">
  <bpmn:message id="Message_Letter" name="Letter" />
  <bpmn:message id="Message_Reply" name="Reply" />
  <bpmn:collaboration id="collaboration">
    <bpmn:participant id="university" name="University" processRef="university-process" />
    <bpmn:participant id="sender" name="Sender" />
    <bpmn:messageFlow id="m-sender-received" name="Letter" sourceRef="sender" targetRef="received" messageRef="Message_Letter" />
    <bpmn:messageFlow id="m-done-sender" name="Reply" sourceRef="done" targetRef="sender" messageRef="Message_Reply" />
  </bpmn:collaboration>
  <bpmn:process id="university-process" name="Registering incoming letters" isExecutable="false">
    <bpmn:laneSet id="university-lanes">
      <bpmn:lane id="registry" name="Registry office">
        <bpmn:flowNodeRef>received</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>register</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>assign</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>urgent</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="unit" name="Responsible unit">
        <bpmn:flowNodeRef>file</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>handle</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>deadline</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>reply</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>done</bpmn:flowNodeRef>
      </bpmn:lane>
    </bpmn:laneSet>
    <bpmn:startEvent id="received" name="Letter received">
      <bpmn:messageEventDefinition id="received-def" messageRef="Message_Letter" />
    </bpmn:startEvent>
    <bpmn:userTask id="register" name="Register the letter" />
    <bpmn:businessRuleTask id="assign" name="Assign the responsible unit" />
    <bpmn:exclusiveGateway id="urgent" name="Is the letter urgent?" default="f-urgent-file" />
    <bpmn:userTask id="file" name="File the letter for later" />
    <bpmn:userTask id="handle" name="Handle the case" />
    <bpmn:boundaryEvent id="deadline" name="14 days passed" attachedToRef="handle">
      <bpmn:timerEventDefinition id="deadline-def">
        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">P14D</bpmn:timeDuration>
      </bpmn:timerEventDefinition>
    </bpmn:boundaryEvent>
    <bpmn:userTask id="reply" name="Prepare the reply" />
    <bpmn:endEvent id="done" name="Reply sent">
      <bpmn:messageEventDefinition id="done-def" messageRef="Message_Reply" />
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="f-received-register" sourceRef="received" targetRef="register" />
    <bpmn:sequenceFlow id="f-register-assign" sourceRef="register" targetRef="assign" />
    <bpmn:sequenceFlow id="f-assign-urgent" sourceRef="assign" targetRef="urgent" />
    <bpmn:sequenceFlow id="f-urgent-handle" name="yes" sourceRef="urgent" targetRef="handle">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">urgency = "high"</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="f-urgent-file" name="no" sourceRef="urgent" targetRef="file" />
    <bpmn:sequenceFlow id="f-file-handle" sourceRef="file" targetRef="handle" />
    <bpmn:sequenceFlow id="f-handle-reply" sourceRef="handle" targetRef="reply" />
    <bpmn:sequenceFlow id="f-reply-done" sourceRef="reply" targetRef="done" />
    <bpmn:sequenceFlow id="f-deadline-reply" sourceRef="deadline" targetRef="reply" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="collaboration">
      <bpmndi:BPMNShape id="university_di" bpmnElement="university" isHorizontal="true">
        <dc:Bounds x="0" y="0" width="1100" height="280" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="sender_di" bpmnElement="sender" isHorizontal="true">
        <dc:Bounds x="0" y="320" width="1100" height="70" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="registry_di" bpmnElement="registry" isHorizontal="true">
        <dc:Bounds x="30" y="0" width="1070" height="140" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="unit_di" bpmnElement="unit" isHorizontal="true">
        <dc:Bounds x="30" y="140" width="1070" height="140" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="received_di" bpmnElement="received">
        <dc:Bounds x="90" y="52" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="85" y="26" width="46" height="23" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="register_di" bpmnElement="register">
        <dc:Bounds x="176" y="30" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="assign_di" bpmnElement="assign">
        <dc:Bounds x="326" y="30" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="urgent_di" bpmnElement="urgent" isMarkerVisible="true">
        <dc:Bounds x="476" y="45" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="442" y="31" width="118" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="file_di" bpmnElement="file">
        <dc:Bounds x="576" y="170" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="handle_di" bpmnElement="handle">
        <dc:Bounds x="726" y="170" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="reply_di" bpmnElement="reply">
        <dc:Bounds x="876" y="170" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="done_di" bpmnElement="done">
        <dc:Bounds x="1026" y="192" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1016" y="178" width="56" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="deadline_di" bpmnElement="deadline">
        <dc:Bounds x="778" y="232" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="696" y="270" width="80" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="m-sender-received_di" bpmnElement="m-sender-received">
        <di:waypoint x="108" y="320" />
        <di:waypoint x="108" y="88" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="114" y="94" width="34" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="m-done-sender_di" bpmnElement="m-done-sender">
        <di:waypoint x="1044" y="228" />
        <di:waypoint x="1044" y="320" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1050" y="262" width="28" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-received-register_di" bpmnElement="f-received-register">
        <di:waypoint x="126" y="70" />
        <di:waypoint x="176" y="70" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-register-assign_di" bpmnElement="f-register-assign">
        <di:waypoint x="276" y="70" />
        <di:waypoint x="326" y="70" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-assign-urgent_di" bpmnElement="f-assign-urgent">
        <di:waypoint x="426" y="70" />
        <di:waypoint x="476" y="70" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-urgent-handle_di" bpmnElement="f-urgent-handle">
        <di:waypoint x="526" y="70" />
        <di:waypoint x="776" y="70" />
        <di:waypoint x="776" y="170" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="781" y="80" width="18" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-urgent-file_di" bpmnElement="f-urgent-file">
        <di:waypoint x="501" y="95" />
        <di:waypoint x="501" y="210" />
        <di:waypoint x="576" y="210" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="509" y="195" width="12" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-file-handle_di" bpmnElement="f-file-handle">
        <di:waypoint x="676" y="218" />
        <di:waypoint x="726" y="218" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-handle-reply_di" bpmnElement="f-handle-reply">
        <di:waypoint x="826" y="210" />
        <di:waypoint x="876" y="210" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-reply-done_di" bpmnElement="f-reply-done">
        <di:waypoint x="976" y="210" />
        <di:waypoint x="1026" y="210" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-deadline-reply_di" bpmnElement="f-deadline-reply">
        <di:waypoint x="796" y="268" />
        <di:waypoint x="796" y="270" />
        <di:waypoint x="926" y="270" />
        <di:waypoint x="926" y="250" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
