<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
  <bpmn:process id="DoAllocateNSSI" name="DoAllocateNSSI" isExecutable="true">
    <bpmn:startEvent id="StartEvent_0zs8ezi" name="Start">
      <bpmn:outgoing>SequenceFlow_07xkshs</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:scriptTask id="ScriptTask_0n2z0z7" name="Preprocess Request" scriptFormat="groovy">
      <bpmn:incoming>SequenceFlow_07xkshs</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0h6mn7j</bpmn:outgoing>
      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcnssi = new DoAllocateNSSI()
dcnssi.preProcessRequest(execution)</bpmn:script>
    </bpmn:scriptTask>
    <bpmn:sequenceFlow id="SequenceFlow_07xkshs" sourceRef="StartEvent_0zs8ezi" targetRef="ScriptTask_0n2z0z7" />
    <bpmn:scriptTask id="ScriptTask_15a7mua" name="send request to NSSMF adapter" scriptFormat="groovy">
      <bpmn:incoming>SequenceFlow_0h6mn7j</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1wclf50</bpmn:outgoing>
      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcnssi = new DoAllocateNSSI()
dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script>
    </bpmn:scriptTask>
    <bpmn:sequenceFlow id="SequenceFlow_1wclf50" sourceRef="ScriptTask_15a7mua" targetRef="Task_1ym947s" />
    <bpmn:sequenceFlow id="SequenceFlow_0h6mn7j" sourceRef="ScriptTask_0n2z0z7" targetRef="ScriptTask_15a7mua" />
    <bpmn:scriptTask id="Task_1ym947s" name="Query NSSI progress from adapter" scriptFormat="groovy">
      <bpmn:incoming>SequenceFlow_0gpgxw4</bpmn:incoming>
      <bpmn:incoming>SequenceFlow_1wclf50</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0p9gd2n</bpmn:outgoing>
      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcnssi = new DoAllocateNSSI()
dcnssi.queryNSSIStatus(execution)</bpmn:script>
    </bpmn:scriptTask>
    <bpmn:scriptTask id="ScriptTask_0ki1c4k" name="Prepare Update Orchestration Task" scriptFormat="groovy">
      <bpmn:incoming>SequenceFlow_0p9gd2n</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_1ozi7ed</bpmn:outgoing>
      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcnssi = new DoAllocateNSSI()
dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script>
    </bpmn:scriptTask>
    <bpmn:callActivity id="CallActivity_0knipxf" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
      <bpmn:extensionElements>
        <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
        <camunda:out source="response" target="CSSOT_dbResponse" />
        <camunda:in source="CSSOT_taskId" target="taskId" />
        <camunda:in source="msoRequestId" target="requestId" />
        <camunda:in source="CSSOT_name" target="taskName" />
        <camunda:in source="CSSOT_status" target="taskStatus" />
        <camunda:in source="CSSOT_isManual" target="isManual" />
        <camunda:in source="CSSOT_paramJson" target="paramJson" />
        <camunda:in source="CSSOT_requestMethod" target="method" />
      </bpmn:extensionElements>
      <bpmn:incoming>SequenceFlow_1ozi7ed</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0hgv9c5</bpmn:outgoing>
    </bpmn:callActivity>
    <bpmn:sequenceFlow id="SequenceFlow_1ozi7ed" sourceRef="ScriptTask_0ki1c4k" targetRef="CallActivity_0knipxf" />
    <bpmn:sequenceFlow id="SequenceFlow_0p9gd2n" sourceRef="Task_1ym947s" targetRef="ScriptTask_0ki1c4k" />
    <bpmn:exclusiveGateway id="ExclusiveGateway_11gv703" name="Completed" default="SequenceFlow_0y5jr25">
      <bpmn:incoming>SequenceFlow_0hgv9c5</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0y5jr25</bpmn:outgoing>
      <bpmn:outgoing>SequenceFlow_170frn3</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="SequenceFlow_0hgv9c5" sourceRef="CallActivity_0knipxf" targetRef="ExclusiveGateway_11gv703" />
    <bpmn:scriptTask id="ScriptTask_1s7bt3s" name="Time delay" scriptFormat="groovy">
      <bpmn:incoming>SequenceFlow_0y5jr25</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_0gpgxw4</bpmn:outgoing>
      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcnssi = new DoAllocateNSSI()
dcnssi.timeDelay(execution)</bpmn:script>
    </bpmn:scriptTask>
    <bpmn:sequenceFlow id="SequenceFlow_0y5jr25" name="false" sourceRef="ExclusiveGateway_11gv703" targetRef="ScriptTask_1s7bt3s" />
    <bpmn:sequenceFlow id="SequenceFlow_0gpgxw4" sourceRef="ScriptTask_1s7bt3s" targetRef="Task_1ym947s" />
    <bpmn:sequenceFlow id="SequenceFlow_170frn3" name="yes" sourceRef="ExclusiveGateway_11gv703" targetRef="IntermediateThrowEvent_10xe1qh">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("jobFinished" )  == true)}</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:endEvent id="IntermediateThrowEvent_10xe1qh">
      <bpmn:incoming>SequenceFlow_170frn3</bpmn:incoming>
    </bpmn:endEvent>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSI">
      <bpmndi:BPMNShape id="StartEvent_0zs8ezi_di" bpmnElement="StartEvent_0zs8ezi">
        <dc:Bounds x="147" y="112" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="152" y="153" width="25" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ScriptTask_0n2z0z7_di" bpmnElement="ScriptTask_0n2z0z7">
        <dc:Bounds x="270" y="90" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_07xkshs_di" bpmnElement="SequenceFlow_07xkshs">
        <di:waypoint x="183" y="130" />
        <di:waypoint x="270" y="130" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ScriptTask_15a7mua_di" bpmnElement="ScriptTask_15a7mua">
        <dc:Bounds x="460" y="90" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1wclf50_di" bpmnElement="SequenceFlow_1wclf50">
        <di:waypoint x="560" y="130" />
        <di:waypoint x="670" y="130" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_0h6mn7j_di" bpmnElement="SequenceFlow_0h6mn7j">
        <di:waypoint x="370" y="130" />
        <di:waypoint x="460" y="130" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ScriptTask_0bt5d96_di" bpmnElement="Task_1ym947s">
        <dc:Bounds x="670" y="90" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="ScriptTask_0ki1c4k_di" bpmnElement="ScriptTask_0ki1c4k">
        <dc:Bounds x="840" y="90" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="CallActivity_0knipxf_di" bpmnElement="CallActivity_0knipxf">
        <dc:Bounds x="1040" y="90" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_1ozi7ed_di" bpmnElement="SequenceFlow_1ozi7ed">
        <di:waypoint x="940" y="130" />
        <di:waypoint x="1040" y="130" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_0p9gd2n_di" bpmnElement="SequenceFlow_0p9gd2n">
        <di:waypoint x="770" y="130" />
        <di:waypoint x="840" y="130" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ExclusiveGateway_11gv703_di" bpmnElement="ExclusiveGateway_11gv703" isMarkerVisible="true">
        <dc:Bounds x="1245" y="105" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1243" y="81" width="54" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_0hgv9c5_di" bpmnElement="SequenceFlow_0hgv9c5">
        <di:waypoint x="1140" y="130" />
        <di:waypoint x="1245" y="130" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="ScriptTask_1s7bt3s_di" bpmnElement="ScriptTask_1s7bt3s">
        <dc:Bounds x="1220" y="230" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="SequenceFlow_0y5jr25_di" bpmnElement="SequenceFlow_0y5jr25">
        <di:waypoint x="1270" y="155" />
        <di:waypoint x="1270" y="230" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1251" y="195" width="23" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_0gpgxw4_di" bpmnElement="SequenceFlow_0gpgxw4">
        <di:waypoint x="1220" y="270" />
        <di:waypoint x="720" y="270" />
        <di:waypoint x="720" y="170" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="SequenceFlow_170frn3_di" bpmnElement="SequenceFlow_170frn3">
        <di:waypoint x="1295" y="130" />
        <di:waypoint x="1372" y="130" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1325" y="112" width="17" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="EndEvent_1q1vntz_di" bpmnElement="IntermediateThrowEvent_10xe1qh">
        <dc:Bounds x="1372" y="112" width="36" height="36" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>