Update Delete Resource Flow

Update Delete Resource Flow

Change-Id: Ie6270d954fc1c703de4bdd0c8f1e543a155060d1
Issue-ID: SO-587
Signed-off-by: c00149107 <chenchuanyu@huawei.com>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn
index 2b9b874..8da0ae0 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn
@@ -13,15 +13,15 @@
 ddrs.preResourceDelete(execution)]]></bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="ScriptTask_15zy0jf" name="Execute Delete Resource Recipe" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1qm7owo</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_098gain</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1ly5jrs</bpmn:outgoing>
       <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-String resourceName = execution.getVariable("resourceType")
 def ddr = new DoDeleteResourcesV1()
-ddr.executeResourceDelete(execution, resourceName )]]></bpmn:script>
+ddr.executeResourceDelete(execution)]]></bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="ScriptTask_1gf78zz" name="Parse Next Resource" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1ly5jrs</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0djplpd</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0i1gez5</bpmn:outgoing>
       <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
 def ddr = new DoDeleteResourcesV1()
@@ -33,7 +33,7 @@
       <bpmn:outgoing>SequenceFlow_1d5mzit</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:sequenceFlow id="SequenceFlow_0stqur4" sourceRef="StartEvent_1" targetRef="Task_1ue68b0" />
-    <bpmn:sequenceFlow id="SequenceFlow_1qm7owo" sourceRef="ScriptTask_0ngvt9d" targetRef="ScriptTask_15zy0jf" />
+    <bpmn:sequenceFlow id="SequenceFlow_1qm7owo" sourceRef="ScriptTask_0ngvt9d" targetRef="ExclusiveGateway_0khn1my" />
     <bpmn:sequenceFlow id="SequenceFlow_1ly5jrs" sourceRef="ScriptTask_15zy0jf" targetRef="ScriptTask_1gf78zz" />
     <bpmn:sequenceFlow id="SequenceFlow_0i1gez5" sourceRef="ScriptTask_1gf78zz" targetRef="ExclusiveGateway_0rtr0n7" />
     <bpmn:sequenceFlow id="SequenceFlow_1oil1t3" name="No" sourceRef="ExclusiveGateway_0rtr0n7" targetRef="ScriptTask_0ngvt9d">
@@ -108,6 +108,46 @@
 def ddrs = new DoDeleteResourcesV1()
 ddrs.preProcessRequest(execution)]]></bpmn:script>
     </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0khn1my" name="Is The Resource Instance Exists">
+      <bpmn:incoming>SequenceFlow_1qm7owo</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_098gain</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_19ccmqv</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_098gain" name="yes" sourceRef="ExclusiveGateway_0khn1my" targetRef="ScriptTask_15zy0jf">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("resourceInstanceId" )  != "" )}]]></bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:serviceTask id="ServiceTask_1bw1mjh" name="update progress update">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_11bgbsh</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0djplpd</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:scriptTask id="ScriptTask_0shhhxr" name="Prepare progress finished for the resource" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_19ccmqv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_11bgbsh</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def dcsi = new DoDeleteResourcesV1()
+dcsi.prepareFinishedProgressForResource(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_11bgbsh" sourceRef="ScriptTask_0shhhxr" targetRef="ServiceTask_1bw1mjh" />
+    <bpmn:sequenceFlow id="SequenceFlow_19ccmqv" name="no" sourceRef="ExclusiveGateway_0khn1my" targetRef="ScriptTask_0shhhxr" />
+    <bpmn:sequenceFlow id="SequenceFlow_0djplpd" sourceRef="ServiceTask_1bw1mjh" targetRef="ScriptTask_1gf78zz" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteResourcesV1">
@@ -121,10 +161,10 @@
         <dc:Bounds x="392" y="233" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_15zy0jf_di" bpmnElement="ScriptTask_15zy0jf">
-        <dc:Bounds x="587" y="233" width="100" height="80" />
+        <dc:Bounds x="665" y="233" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1gf78zz_di" bpmnElement="ScriptTask_1gf78zz">
-        <dc:Bounds x="802" y="233" width="100" height="80" />
+        <dc:Bounds x="865" y="233" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_0rtr0n7_di" bpmnElement="ExclusiveGateway_0rtr0n7" isMarkerVisible="true">
         <dc:Bounds x="1011" y="248" width="50" height="50" />
@@ -141,23 +181,23 @@
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1qm7owo_di" bpmnElement="SequenceFlow_1qm7owo">
         <di:waypoint xsi:type="dc:Point" x="492" y="273" />
-        <di:waypoint xsi:type="dc:Point" x="587" y="273" />
+        <di:waypoint xsi:type="dc:Point" x="550" y="273" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="539.5" y="252" width="0" height="12" />
+          <dc:Bounds x="476" y="252" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1ly5jrs_di" bpmnElement="SequenceFlow_1ly5jrs">
-        <di:waypoint xsi:type="dc:Point" x="687" y="273" />
-        <di:waypoint xsi:type="dc:Point" x="802" y="273" />
+        <di:waypoint xsi:type="dc:Point" x="765" y="273" />
+        <di:waypoint xsi:type="dc:Point" x="865" y="273" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="744.5" y="252" width="0" height="12" />
+          <dc:Bounds x="770" y="252" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0i1gez5_di" bpmnElement="SequenceFlow_0i1gez5">
-        <di:waypoint xsi:type="dc:Point" x="902" y="273" />
+        <di:waypoint xsi:type="dc:Point" x="965" y="273" />
         <di:waypoint xsi:type="dc:Point" x="1011" y="273" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="956.5" y="252" width="0" height="12" />
+          <dc:Bounds x="943" y="252" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1oil1t3_di" bpmnElement="SequenceFlow_1oil1t3">
@@ -298,6 +338,49 @@
       <bpmndi:BPMNShape id="ScriptTask_1tdnal8_di" bpmnElement="Task_1ue68b0">
         <dc:Bounds x="38" y="233" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_0khn1my_di" bpmnElement="ExclusiveGateway_0khn1my" isMarkerVisible="true">
+        <dc:Bounds x="550" y="248" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="536" y="301" width="79" height="28" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_098gain_di" bpmnElement="SequenceFlow_098gain">
+        <di:waypoint xsi:type="dc:Point" x="600" y="273" />
+        <di:waypoint xsi:type="dc:Point" x="665" y="273" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="624" y="251" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ServiceTask_1bw1mjh_di" bpmnElement="ServiceTask_1bw1mjh">
+        <dc:Bounds x="865" y="112" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0shhhxr_di" bpmnElement="ScriptTask_0shhhxr">
+        <dc:Bounds x="665" y="112" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_11bgbsh_di" bpmnElement="SequenceFlow_11bgbsh">
+        <di:waypoint xsi:type="dc:Point" x="765" y="152" />
+        <di:waypoint xsi:type="dc:Point" x="865" y="152" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="815" y="130" width="0" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_19ccmqv_di" bpmnElement="SequenceFlow_19ccmqv">
+        <di:waypoint xsi:type="dc:Point" x="575" y="248" />
+        <di:waypoint xsi:type="dc:Point" x="575" y="152" />
+        <di:waypoint xsi:type="dc:Point" x="665" y="152" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="584" y="193" width="12" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0djplpd_di" bpmnElement="SequenceFlow_0djplpd">
+        <di:waypoint xsi:type="dc:Point" x="915" y="192" />
+        <di:waypoint xsi:type="dc:Point" x="915" y="213" />
+        <di:waypoint xsi:type="dc:Point" x="915" y="213" />
+        <di:waypoint xsi:type="dc:Point" x="915" y="233" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="930" y="206" width="0" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>