<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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" xmlns="http://www.jboss.org/drools" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd" id="Definition" expressionLanguage="http://www.mvel.org/2.0" targetNamespace="http://www.example.org/MinimalExample" typeLanguage="http://www.java.com/javaTypes">
  <bpmn2:error id="_exception" errorCode="mycode"/>
  <bpmn2:error id="mycode" name="mycode"/>
  <bpmn2:process id="ErrorEventHandling" tns:version="1" tns:packageName="defaultPackage" tns:adHoc="false" name="Throw Error Event With Script Task" isExecutable="true" processType="Private">
    <bpmn2:startEvent id="_1" name="start">
      <bpmn2:outgoing>_1-_2</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:sequenceFlow id="_1-_2" tns:priority="1" name="" sourceRef="_1" targetRef="_2"/>
    <bpmn2:subProcess id="_2" name="subprocess">
      <bpmn2:incoming>_1-_2</bpmn2:incoming>
      <bpmn2:outgoing>_2-_3</bpmn2:outgoing>
      <bpmn2:startEvent id="_2-1" name="sub-start">
        <bpmn2:outgoing>_2-1-_2-2</bpmn2:outgoing>
      </bpmn2:startEvent>
      <bpmn2:sequenceFlow id="_2-1-_2-2" tns:priority="1" name="" sourceRef="_2-1" targetRef="_2-2"/>
      <bpmn2:scriptTask id="_2-2" name="signal error">
        <bpmn2:incoming>_2-1-_2-2</bpmn2:incoming>
        <bpmn2:outgoing>_2-2-_2-3</bpmn2:outgoing>
        <bpmn2:script>kcontext.getProcessInstance().signalEvent(&quot;Error-_2-mycode&quot;, null);</bpmn2:script>
      </bpmn2:scriptTask>
      <bpmn2:sequenceFlow id="_2-2-_2-3" tns:priority="1" name="" sourceRef="_2-2" targetRef="_2-3"/>
      <bpmn2:endEvent id="_2-3" name="sub-end">
        <bpmn2:incoming>_2-2-_2-3</bpmn2:incoming>
      </bpmn2:endEvent>
    </bpmn2:subProcess>
    <bpmn2:sequenceFlow id="_2-_3" tns:priority="1" name="" sourceRef="_2" targetRef="_3"/>
    <bpmn2:scriptTask id="_3" name="script">
      <bpmn2:incoming>_2-_3</bpmn2:incoming>
      <bpmn2:outgoing>_3-_4</bpmn2:outgoing>
      <bpmn2:script>System.out.println(&quot;Normal process end&quot;);</bpmn2:script>
    </bpmn2:scriptTask>
    <bpmn2:sequenceFlow id="_3-_4" tns:priority="1" name="" sourceRef="_3" targetRef="_4"/>
    <bpmn2:endEvent id="_4" name="end">
      <bpmn2:incoming>_3-_4</bpmn2:incoming>
      <bpmn2:terminateEventDefinition id="TerminateEventDefinition_1"/>
    </bpmn2:endEvent>
    <bpmn2:boundaryEvent id="BoundaryEvent_1" name="" attachedToRef="_2">
      <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
      <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" errorRef="mycode"/>
    </bpmn2:boundaryEvent>
    <bpmn2:sequenceFlow id="SequenceFlow_1" tns:priority="1" sourceRef="BoundaryEvent_1" targetRef="_6"/>
    <bpmn2:endEvent id="_7" name="error end">
      <bpmn2:incoming>_6-_7</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:scriptTask id="_6" name="error handling">
      <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
      <bpmn2:outgoing>_6-_7</bpmn2:outgoing>
      <bpmn2:script>System.out.println(&quot;Handling with error&quot;);</bpmn2:script>
    </bpmn2:scriptTask>
    <bpmn2:sequenceFlow id="_6-_7" tns:priority="1" name="" sourceRef="_6" targetRef="_7"/>
  </bpmn2:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_Process_1" bpmnElement="ErrorEventHandling">
      <bpmndi:BPMNShape id="BPMNShape_SubProcess_1" bpmnElement="_2" isExpanded="true">
        <dc:Bounds height="150.0" width="382.0" x="136.0" y="150.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_StartEvent_1" bpmnElement="_1">
        <dc:Bounds height="36.0" width="36.0" x="50.0" y="207.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_StartEvent_2" bpmnElement="_2-1">
        <dc:Bounds height="36.0" width="36.0" x="186.0" y="200.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="_2-3">
        <dc:Bounds height="36.0" width="36.0" x="432.0" y="200.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_EndEvent_2" bpmnElement="_4">
        <dc:Bounds height="36.0" width="36.0" x="728.0" y="207.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_EndEvent_3" bpmnElement="_7">
        <dc:Bounds height="36.0" width="36.0" x="460.0" y="57.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_ScriptTask_1" bpmnElement="_2-2">
        <dc:Bounds height="50.0" width="110.0" x="272.0" y="193.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_ScriptTask_2" bpmnElement="_3">
        <dc:Bounds height="50.0" width="110.0" x="568.0" y="200.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_BoundaryEvent_2" bpmnElement="BoundaryEvent_1">
        <dc:Bounds height="36.0" width="36.0" x="198.0" y="132.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_ScriptTask_3" bpmnElement="_6">
        <dc:Bounds height="50.0" width="110.0" x="272.0" y="50.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="_1-_2" sourceElement="BPMNShape_StartEvent_1" targetElement="BPMNShape_SubProcess_1">
        <di:waypoint xsi:type="dc:Point" x="86.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="125.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="125.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="136.0" y="225.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="_2-_3" sourceElement="BPMNShape_SubProcess_1" targetElement="BPMNShape_ScriptTask_2">
        <di:waypoint xsi:type="dc:Point" x="518.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="550.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="550.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="568.0" y="225.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="_2-1-_2-2" sourceElement="BPMNShape_StartEvent_2" targetElement="BPMNShape_ScriptTask_1">
        <di:waypoint xsi:type="dc:Point" x="222.0" y="218.0"/>
        <di:waypoint xsi:type="dc:Point" x="254.0" y="218.0"/>
        <di:waypoint xsi:type="dc:Point" x="254.0" y="218.0"/>
        <di:waypoint xsi:type="dc:Point" x="272.0" y="218.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="_2-2-_2-3" sourceElement="BPMNShape_ScriptTask_1" targetElement="BPMNShape_EndEvent_1">
        <di:waypoint xsi:type="dc:Point" x="382.0" y="218.0"/>
        <di:waypoint xsi:type="dc:Point" x="420.0" y="218.0"/>
        <di:waypoint xsi:type="dc:Point" x="420.0" y="218.0"/>
        <di:waypoint xsi:type="dc:Point" x="432.0" y="218.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="_3-_4" sourceElement="BPMNShape_ScriptTask_2" targetElement="BPMNShape_EndEvent_2">
        <di:waypoint xsi:type="dc:Point" x="678.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="716.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="716.0" y="225.0"/>
        <di:waypoint xsi:type="dc:Point" x="728.0" y="225.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="_6-_7" sourceElement="BPMNShape_ScriptTask_3" targetElement="BPMNShape_EndEvent_3">
        <di:waypoint xsi:type="dc:Point" x="382.0" y="75.0"/>
        <di:waypoint xsi:type="dc:Point" x="440.0" y="75.0"/>
        <di:waypoint xsi:type="dc:Point" x="440.0" y="75.0"/>
        <di:waypoint xsi:type="dc:Point" x="460.0" y="75.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_1" sourceElement="BPMNShape_BoundaryEvent_2" targetElement="BPMNShape_ScriptTask_3">
        <di:waypoint xsi:type="dc:Point" x="216.0" y="132.0"/>
        <di:waypoint xsi:type="dc:Point" x="216.0" y="75.0"/>
        <di:waypoint xsi:type="dc:Point" x="272.0" y="75.0"/>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>