Delete bug fix for R3 config changes

Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064407
Issue-ID: SO-1184
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
index 238ac82..b30929d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
@@ -503,7 +503,9 @@
                     resourceTemplateUUIDs  = resourceTemplateUUIDs + it.resourceInstanceId + ":"
                 }
             }
-            execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+            
+            def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+            execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint)
 
             String payload =
                 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
index 5bc1e65..59ea5c2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
@@ -916,8 +916,6 @@
             execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
             msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
 
-            execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
-
 			String payload =
                 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                         xmlns:ns="http://org.onap.so/requestsdb">
@@ -984,7 +982,8 @@
                     }
                 }
             }
-            def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
+
+            def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
             execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
             msoLogger.info("DB Adapter Endpoint is: " + dbAdapterEndpoint)
 
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index 3630df0..a981abf 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -30,18 +30,19 @@
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.json.JSONArray
 import org.json.JSONObject
-import org.onap.so.bpmn.common.scripts.AaiUtil
+
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.domain.Resource
 import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.UrnPropertiesReader
 
 import org.onap.so.utils.TargetEntity
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
-import org.springframework.web.util.UriUtils;
+import org.springframework.web.util.UriUtils
 import org.w3c.dom.Document
 import org.w3c.dom.Element
 import org.w3c.dom.Node
@@ -417,8 +418,9 @@
 		def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
 		utils.log("INFO"," ***** Started getRelatedResourceInAAI *****",  isDebugEnabled)
 
-		AaiUtil aaiUriUtil = new AaiUtil()
-		String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+//		AaiUtil aaiUriUtil = new AaiUtil()
+//		String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+        String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
 		String urlLink = jObj.get("resourceLinkUrl")
 		String serviceAaiPath = "${aai_endpoint}${urlLink}"
 
@@ -518,6 +520,12 @@
 
             // only delete real existing resources
             execution.setVariable("deleteResourceList", deleteRealResourceList)
+            
+            boolean isDeleteResourceListValid = false
+            if(deleteRealResourceList.size() > 0) {
+                isDeleteResourceListValid = true
+            }
+            execution.setVariable("isDeleteResourceListValid", isDeleteResourceListValid)
 
             utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled)
         } catch (Exception ex) {
@@ -553,8 +561,8 @@
                     resourceTemplateUUIDs  = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
             }
 
-
-            execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+            def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+            execution.setVariable("URN_mso_adapters_openecomp_db_endpoint", dbAdapterEndpoint)
 
             String payload =
                     """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -581,6 +589,53 @@
         }
         utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
     }
+    
+    public void prepareUpdateServiceOperationStatus(DelegateExecution execution){
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("DEBUG", " ======== STARTED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
+        try{
+            String serviceId = execution.getVariable("serviceInstanceId")
+            String operationId = execution.getVariable("operationId")
+            String userId = ""
+            String result = execution.getVariable("result")
+            String progress = execution.getVariable("progress")
+            String reason = ""
+            String operationContent = execution.getVariable("operationContent")
+            
+            serviceId = UriUtils.encode(serviceId,"UTF-8")
+
+            def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+            execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+            utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+            String payload =
+                    """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                        xmlns:ns="http://org.onap.so/requestsdb">
+                        <soapenv:Header/>
+                        <soapenv:Body>
+                            <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+                            <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+                            <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+                            <operationType>DELETE</operationType>
+                            <userId>${MsoUtils.xmlEscape(userId)}</userId>
+                            <result>${MsoUtils.xmlEscape(result)}</result>
+                            <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
+                            <progress>${MsoUtils.xmlEscape(progress)}</progress>
+                            <reason>${MsoUtils.xmlEscape(reason)}</reason>
+                        </ns:updateServiceOperationStatus>
+                    </soapenv:Body>
+                </soapenv:Envelope>"""
+
+            payload = utils.formatXml(payload)
+            execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+            utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+
+        }catch(Exception e){
+            utils.log("ERROR", "Exception Occured Processing prepareUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+            execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateServiceOperationStatus Method:\n" + e.getMessage())
+        }
+        utils.log("DEBUG", "======== COMPLETED prepareUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
+    }
 
      /**
       * post config request.
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 9accbd8..122cc08 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -214,14 +214,19 @@
         List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
 
         int currentIndex = execution.getVariable("currentResourceIndex")
-        Resource curResource = sequencedResourceList.get(currentIndex);
+        if(sequencedResourceList != null && sequencedResourceList.size() > currentIndex){
+            Resource curResource = sequencedResourceList.get(currentIndex);
 
-        String resourceInstanceUUID = curResource.getResourceId()
-        String resourceTemplateUUID = curResource.getModelInfo().getModelUuid()
-        execution.setVariable("resourceInstanceId", resourceInstanceUUID)
-        execution.setVariable("currentResource", curResource)
-        utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + "  resourceInstanceId: "
-                + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled)
+            String resourceInstanceUUID = curResource.getResourceId()
+            String resourceTemplateUUID = curResource.getModelInfo().getModelUuid()
+            execution.setVariable("resourceInstanceId", resourceInstanceUUID)
+            execution.setVariable("currentResource", curResource)
+            utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + "  resourceInstanceId: "
+                    + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled)
+        }
+        else {
+            execution.setVariable("resourceInstanceId", "")
+        }
 
         utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled)
     }
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
index 58ee260..baa695a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
@@ -169,7 +169,7 @@
 				resourceTemplateUUIDs  = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
 			}
 
-			def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
+            def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
 			execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
 			utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
 
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
index df0cd46..4127c3a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
@@ -153,8 +153,6 @@
 			execution.setVariable("operationType", "update")
 			execution.setVariable("hasResourcetoUpdate", false)
 
-			execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
-
 		} catch (BpmnError e) {
 			throw e;
 		} catch (Exception ex){
@@ -309,11 +307,10 @@
 			execution.setVariable("operationId", operationId)
 			execution.setVariable("operationType", operationType)
 
-			def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
-			execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+            def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+            execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
 			utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
 
-			execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
 			String payload =
 				"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                         xmlns:ns="http://org.onap.so/requestsdb">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
index a975ebd..17f6c66 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
@@ -1,5 +1,5 @@
 <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
   <bpmn:process id="DoDeleteE2EServiceInstance" name="All Resources Deleted" isExecutable="true">
     <bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow">
       <bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing>
@@ -24,6 +24,7 @@
     </bpmn:scriptTask>
     <bpmn:scriptTask id="ScriptTask_01erufg" name="&#10;AAI&#10;Delete&#10;(svc instance)&#10;" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1cevtpy</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_12rr1yy</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0e7inkl</bpmn:outgoing>
       <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
 def ddsi = new DoCustomDeleteE2EServiceInstance()
@@ -99,11 +100,6 @@
     <bpmn:sequenceFlow id="SequenceFlow_1j08ko3" sourceRef="ServiceTask_00tg69u" targetRef="Task_1f5dlsv" />
     <bpmn:sequenceFlow id="SequenceFlow_0fo5vw5" sourceRef="Task_1ldvug1" targetRef="Task_0mhdfuu" />
     <bpmn:sequenceFlow id="SequenceFlow_0orw2f8" sourceRef="Task_0mhdfuu" targetRef="Task_1yx1n05" />
-    <bpmn:sequenceFlow id="SequenceFlow_0ha8ix9" sourceRef="Task_1yx1n05" targetRef="IntermediateThrowEvent_0ve5ukt" />
-    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ve5ukt" name="Go to Delete Resources">
-      <bpmn:incoming>SequenceFlow_0ha8ix9</bpmn:incoming>
-      <bpmn:linkEventDefinition name="StartDeleteResource" />
-    </bpmn:intermediateThrowEvent>
     <bpmn:intermediateCatchEvent id="startDeleteResources" name="Start Delete Resources">
       <bpmn:outgoing>SequenceFlow_1961633</bpmn:outgoing>
       <bpmn:linkEventDefinition name="StartDeleteResource" />
@@ -133,7 +129,7 @@
     </bpmn:callActivity>
     <bpmn:scriptTask id="Task_1yx1n05" name="Post Decompose Service" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0orw2f8</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0ha8ix9</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_013rime</bpmn:outgoing>
       <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
 def dcsi= new DoDeleteE2EServiceInstance()
 dcsi.postDecomposeService(execution)]]></bpmn:script>
@@ -167,6 +163,63 @@
       <bpmn:linkEventDefinition name="DecomposeService" />
     </bpmn:intermediateThrowEvent>
     <bpmn:sequenceFlow id="SequenceFlow_0vi0sv6" sourceRef="ScriptTask_1rtnsh8" targetRef="StartEvent_1qh5a34" />
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_00pyc0n" name="Start Delete Resources">
+      <bpmn:incoming>SequenceFlow_1fozgqz</bpmn:incoming>
+      <bpmn:linkEventDefinition name="StartDeleteResource" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_156mc3h" name="Valid Resource List?" default="SequenceFlow_1ncja2b">
+      <bpmn:incoming>SequenceFlow_013rime</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1fozgqz</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1ncja2b</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1g4uc66" name="End Delete Process">
+      <bpmn:incoming>SequenceFlow_1ncja2b</bpmn:incoming>
+      <bpmn:linkEventDefinition name="EndDeleteProcess" />
+    </bpmn:intermediateThrowEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1fozgqz" name="Yes" sourceRef="ExclusiveGateway_156mc3h" targetRef="IntermediateThrowEvent_00pyc0n">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("isDeleteResourceListValid" )  == true)}]]></bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_1ncja2b" sourceRef="ExclusiveGateway_156mc3h" targetRef="IntermediateThrowEvent_1g4uc66" />
+    <bpmn:sequenceFlow id="SequenceFlow_013rime" sourceRef="Task_1yx1n05" targetRef="ExclusiveGateway_156mc3h" />
+    <bpmn:serviceTask id="ServiceTask_1lsic7i" name="Update Service Operation Status">
+      <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_updateServiceOperStatusRequest}</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_1ab3vex</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_12rr1yy</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:scriptTask id="ScriptTask_0f3tjbn" name="prepare update service operation status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_0h5c1bd</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ab3vex</bpmn:outgoing>
+      <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("progress", "100")
+execution.setVariable("result", "finished")
+execution.setVariable("operationContent", "No actual resoure in service instance")
+def csi= new DoDeleteE2EServiceInstance()
+csi.prepareUpdateServiceOperationStatus(execution)]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0hrkmxb" name="End Delete Process">
+      <bpmn:outgoing>SequenceFlow_0h5c1bd</bpmn:outgoing>
+      <bpmn:linkEventDefinition name="EndDeleteProcess" />
+    </bpmn:intermediateCatchEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1ab3vex" sourceRef="ScriptTask_0f3tjbn" targetRef="ServiceTask_1lsic7i" />
+    <bpmn:sequenceFlow id="SequenceFlow_0h5c1bd" sourceRef="IntermediateCatchEvent_0hrkmxb" targetRef="ScriptTask_0f3tjbn" />
+    <bpmn:sequenceFlow id="SequenceFlow_12rr1yy" sourceRef="ServiceTask_1lsic7i" targetRef="ScriptTask_01erufg" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteE2EServiceInstance">
@@ -192,7 +245,7 @@
         <dc:Bounds x="254" y="450" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="SubProcess_1u8zt9i_di" bpmnElement="SubProcess_1u8zt9i" isExpanded="true">
-        <dc:Bounds x="-166" y="672" width="467" height="193" />
+        <dc:Bounds x="-161" y="980" width="467" height="193" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0vz7cd9_di" bpmnElement="SequenceFlow_0vz7cd9">
         <di:waypoint xsi:type="dc:Point" x="-501" y="-33" />
@@ -220,32 +273,32 @@
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="StartEvent_0sf5lpt_di" bpmnElement="StartEvent_0sf5lpt">
-        <dc:Bounds x="-98" y="739" width="36" height="36" />
+        <dc:Bounds x="-93" y="1047" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-170" y="780" width="90" height="12" />
+          <dc:Bounds x="-165" y="1088" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_06utmg4_di" bpmnElement="EndEvent_06utmg4">
-        <dc:Bounds x="195" y="739" width="36" height="36" />
+        <dc:Bounds x="200" y="1047" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="123" y="780" width="90" height="12" />
+          <dc:Bounds x="128" y="1088" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0nha3pr_di" bpmnElement="ScriptTask_0nha3pr">
-        <dc:Bounds x="6" y="717" width="100" height="80" />
+        <dc:Bounds x="11" y="1025" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1921mo3_di" bpmnElement="SequenceFlow_1921mo3">
-        <di:waypoint xsi:type="dc:Point" x="-62" y="757" />
-        <di:waypoint xsi:type="dc:Point" x="6" y="757" />
+        <di:waypoint xsi:type="dc:Point" x="-57" y="1065" />
+        <di:waypoint xsi:type="dc:Point" x="11" y="1065" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-118" y="742" width="90" height="12" />
+          <dc:Bounds x="-113" y="1050" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_18vlzfo_di" bpmnElement="SequenceFlow_18vlzfo">
-        <di:waypoint xsi:type="dc:Point" x="106" y="757" />
-        <di:waypoint xsi:type="dc:Point" x="195" y="757" />
+        <di:waypoint xsi:type="dc:Point" x="111" y="1065" />
+        <di:waypoint xsi:type="dc:Point" x="200" y="1065" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="62" y="742" width="90" height="12" />
+          <dc:Bounds x="67" y="1050" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_146jt8v_di" bpmnElement="ScriptTask_146jt8v">
@@ -298,21 +351,6 @@
           <dc:Bounds x="-79" y="192" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ha8ix9_di" bpmnElement="SequenceFlow_0ha8ix9">
-        <di:waypoint xsi:type="dc:Point" x="147" y="198" />
-        <di:waypoint xsi:type="dc:Point" x="181" y="198" />
-        <di:waypoint xsi:type="dc:Point" x="181" y="198" />
-        <di:waypoint xsi:type="dc:Point" x="246" y="198" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="151" y="192" width="90" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="IntermediateThrowEvent_15myvzx_di" bpmnElement="IntermediateThrowEvent_0ve5ukt">
-        <dc:Bounds x="246" y="180" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="233" y="220" width="64" height="24" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_1jcfnjr_di" bpmnElement="startDeleteResources">
         <dc:Bounds x="-537" y="472" width="36" height="36" />
         <bpmndi:BPMNLabel>
@@ -373,6 +411,80 @@
           <dc:Bounds x="-16" y="-39" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_00pyc0n_di" bpmnElement="IntermediateThrowEvent_00pyc0n">
+        <dc:Bounds x="398" y="180" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="389" y="220" width="57" height="24" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_156mc3h_di" bpmnElement="ExclusiveGateway_156mc3h" isMarkerVisible="true">
+        <dc:Bounds x="279" y="173" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="266" y="145" width="75" height="24" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateThrowEvent_1g4uc66_di" bpmnElement="IntermediateThrowEvent_1g4uc66">
+        <dc:Bounds x="286" y="270" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="279" y="308" width="53" height="24" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1fozgqz_di" bpmnElement="SequenceFlow_1fozgqz">
+        <di:waypoint xsi:type="dc:Point" x="329" y="198" />
+        <di:waypoint xsi:type="dc:Point" x="398" y="198" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="356.5" y="176" width="19" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ncja2b_di" bpmnElement="SequenceFlow_1ncja2b">
+        <di:waypoint xsi:type="dc:Point" x="304" y="223" />
+        <di:waypoint xsi:type="dc:Point" x="304" y="270" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="274" y="240.5" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_013rime_di" bpmnElement="SequenceFlow_013rime">
+        <di:waypoint xsi:type="dc:Point" x="147" y="198" />
+        <di:waypoint xsi:type="dc:Point" x="279" y="198" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="213" y="177" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ServiceTask_1lsic7i_di" bpmnElement="ServiceTask_1lsic7i">
+        <dc:Bounds x="-121" y="697" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_0f3tjbn_di" bpmnElement="ScriptTask_0f3tjbn">
+        <dc:Bounds x="-399" y="697" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="IntermediateCatchEvent_0hrkmxb_di" bpmnElement="IntermediateCatchEvent_0hrkmxb">
+        <dc:Bounds x="-531" y="719" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-539" y="759" width="53" height="24" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ab3vex_di" bpmnElement="SequenceFlow_1ab3vex">
+        <di:waypoint xsi:type="dc:Point" x="-299" y="737" />
+        <di:waypoint xsi:type="dc:Point" x="-121" y="737" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-255" y="715" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0h5c1bd_di" bpmnElement="SequenceFlow_0h5c1bd">
+        <di:waypoint xsi:type="dc:Point" x="-495" y="737" />
+        <di:waypoint xsi:type="dc:Point" x="-399" y="737" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-492" y="715" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_12rr1yy_di" bpmnElement="SequenceFlow_12rr1yy">
+        <di:waypoint xsi:type="dc:Point" x="-21" y="737" />
+        <di:waypoint xsi:type="dc:Point" x="117" y="737" />
+        <di:waypoint xsi:type="dc:Point" x="117" y="490" />
+        <di:waypoint xsi:type="dc:Point" x="254" y="490" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="132" y="607.5" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
-</bpmn:definitions>
\ No newline at end of file
+</bpmn:definitions>