<?xml version="1.0" encoding="UTF-8"?>

<definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xmlns="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:tns="http://www.jboss.org/drools" 
             xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.omg.org/spec/BPMN/20100524/DI http://www.omg.org/spec/BPMN/20100524/DI-XMI http://www.omg.org/spec/DD/20100524/DC http://www.omg.org/spec/DD/20100524/DC-XMI http://www.omg.org/spec/DD/20100524/DI http://www.omg.org/spec/DD/20100524/DI-XMI" 
             id="Definition" 
             expressionLanguage="http://www.mvel.org/2.0" 
             targetNamespace="http://www.example.org/MinimalExample" 
             typeLanguage="http://www.java.com/javaTypes">

  <itemDefinition id="_stringItem" structureRef="java.lang.String"/>
  <message id="_message" itemRef="_stringItem"/>

  <interface id="_serviceInterface" name="org.jbpm.examples.exceptions.service.ExceptionService">
    <operation id="_serviceOperation" name="throwException">
      <inMessageRef>_message</inMessageRef>
    </operation>
  </interface>

  <signal id="exception-signal" structureRef="_exceptionItem"/>

  <itemDefinition id="_exceptionItem" structureRef="org.kie.api.runtime.process.WorkItem"/>
  <message id="_exceptionMessage" itemRef="_exceptionItem"/>

  <interface id="_handlingServiceInterface" name="org.jbpm.examples.exceptions.service.ExceptionService">
    <operation id="_handlingServiceOperation" name="handleException">
      <inMessageRef>_exceptionMessage</inMessageRef>
    </operation>
  </interface>

  <process id="ProcessWithExceptionHandlingSignal" name="Service Process" isExecutable="true" processType="Private">
    <!-- properties -->
    <property id="serviceInputItem" itemSubjectRef="_stringItem"/>
    <property id="exceptionInputItem" itemSubjectRef="_exceptionItem"/>

    <!-- main process -->
    <startEvent id="_1" name="Start" />
    <serviceTask id="_2" name="Throw Exception" implementation="Other" operationRef="_serviceOperation">
      <ioSpecification>
        <dataInput id="_2_input" name="Parameter"/>
        <dataOutput id="_2_result" name="Result"/>
        <inputSet>
          <dataInputRefs>_2_input</dataInputRefs>
        </inputSet>
        <outputSet>
          <dataOutputRefs>_2_result</dataOutputRefs>
        </outputSet>
      </ioSpecification>
      <dataInputAssociation id="DataInputAssociation_1">
        <sourceRef>serviceInputItem</sourceRef>
        <targetRef>_2_input</targetRef>
      </dataInputAssociation>
      <dataOutputAssociation id="DataOutputAssociation_1">
        <sourceRef>_2_result</sourceRef>
        <targetRef>serviceInputItem</targetRef>
      </dataOutputAssociation>
    </serviceTask>
    <endEvent id="_3" name="End">
      <terminateEventDefinition id="TerminateEventDefinition_1"/>
    </endEvent>
    <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2"/>
    <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3"/>
    <subProcess id="_X" name="Exception Handler" triggeredByEvent="true">
      <startEvent id="_X-1" name="subStart" isInterrupting="false">
        <dataOutput id="_X-1_Output" name="event"/>
        <dataOutputAssociation>
          <sourceRef>_X-1_Output</sourceRef>
          <targetRef>exceptionInputItem</targetRef>
        </dataOutputAssociation>
        <outputSet>
          <dataOutputRefs>_X-1_Output</dataOutputRefs>
        </outputSet>
        <signalEventDefinition id="_X-1_ED_1" signalRef="exception-signal"/>
      </startEvent>
      <serviceTask id="_X-2" name="Handle Exception" implementation="Other" operationRef="_handlingServiceOperation">
        <ioSpecification>
          <dataInput id="_X-2_input" name="Parameter"/>
          <inputSet>
            <dataInputRefs>_X-2_input</dataInputRefs>
          </inputSet>
          <outputSet/>
        </ioSpecification>
        <dataInputAssociation>
          <sourceRef>exceptionInputItem</sourceRef>
          <targetRef>_X-2_input</targetRef>
        </dataInputAssociation>
      </serviceTask>
      <endEvent id="_X-3" name="subEnd" />

      <sequenceFlow id="_X-1-_X_2" sourceRef="_X-1" targetRef="_X-2"/>
      <sequenceFlow id="_X-2-_X_3" sourceRef="_X-2" targetRef="_X-3"/>
    </subProcess>
  </process>
  <bpmndi:BPMNDiagram documentation="background=#FFFFFF;count=1;horizontalcount=1;orientation=0;width=597.6;height=842.4;imageableWidth=587.6;imageableHeight=832.4;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram">
    <bpmndi:BPMNPlane id="BPMNPlane_BaseElement_1" bpmnElement="ServiceProcess">
      <bpmndi:BPMNShape id="di-_X" bpmnElement="_X" isExpanded="true">
        <dc:Bounds height="115.0" width="280.0" x="18.0" y="125.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_1">
          <dc:Bounds height="115.0" width="280.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="di-_3" bpmnElement="_3">
        <dc:Bounds height="32.0" width="32.0" x="265.0" y="42.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_2">
          <dc:Bounds height="32.0" width="32.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="di-_2" bpmnElement="_2">
        <dc:Bounds height="55.0" width="85.0" x="120.0" y="30.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_3">
          <dc:Bounds height="55.0" width="85.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="di-_1" bpmnElement="_1">
        <dc:Bounds height="32.0" width="32.0" x="28.0" y="42.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_4">
          <dc:Bounds height="32.0" width="32.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="di-_X-3" bpmnElement="_X-3">
        <dc:Bounds height="32.0" width="32.0" x="238.0" y="170.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_5">
          <dc:Bounds height="32.0" width="32.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="di-_X-2" bpmnElement="_X-2">
        <dc:Bounds height="55.0" width="85.0" x="110.0" y="159.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_6">
          <dc:Bounds height="55.0" width="85.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="di-_X-1" bpmnElement="_X-1">
        <dc:Bounds height="32.0" width="32.0" x="33.0" y="170.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_7">
          <dc:Bounds height="32.0" width="32.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="di-_X-2-_X_3" bpmnElement="_X-2-_X_3" sourceElement="di-_X-2" targetElement="di-_X-3">
        <di:waypoint xsi:type="dc:Point" x="195.0" y="186.0"/>
        <di:waypoint xsi:type="dc:Point" x="238.0" y="186.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_8">
          <dc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="di-_2-_3" bpmnElement="_2-_3" sourceElement="di-_2" targetElement="di-_3">
        <di:waypoint xsi:type="dc:Point" x="205.0" y="57.0"/>
        <di:waypoint xsi:type="dc:Point" x="265.0" y="58.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_9">
          <dc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="di-_1-_2" bpmnElement="_1-_2" sourceElement="di-_1" targetElement="di-_2">
        <di:waypoint xsi:type="dc:Point" x="60.0" y="58.0"/>
        <di:waypoint xsi:type="dc:Point" x="120.0" y="57.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_10">
          <dc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="di-_X-1-_X_2" bpmnElement="_X-1-_X_2" sourceElement="di-_X-1" targetElement="di-_X-2">
        <di:waypoint xsi:type="dc:Point" x="65.0" y="186.0"/>
        <di:waypoint xsi:type="dc:Point" x="110.0" y="186.0"/>
        <bpmndi:BPMNLabel id="BPMNLabel_11">
          <dc:Bounds height="-1.0" width="-1.0" x="-1.0" y="-1.0"/>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
