Merge "Set Resource Recipe Time Out Val"
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
index f29db92..dff1ecf 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
@@ -226,23 +226,43 @@
 		utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)

     }

     

-    public void preProcessForDeleteResource(DelegateExecution execution) {

-        def isDebugEnabled=execution.getVariable("isDebugLogEnabled")

+	public void preProcessForDeleteResource(DelegateExecution execution) {

+		def isDebugEnabled=execution.getVariable("isDebugLogEnabled")

 		utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled)

-		

+

 		execution.setVariable("operationType", "delete")

-		

-		execution.setVariable("hasResourcetoDelete", false)

+

+		def  hasResourcetoDelete = false

 		List<Resource> delResourceList =  execution.getVariable("delResourceList")

 		if(delResourceList != null && !delResourceList.isEmpty()) {

-			execution.setVariable("hasResourcetoDelete", true)

-		}			

-		

-		execution.setVariable("resourceInstanceIDs", execution.getVariable("serviceRelationShip"))

-		

-		utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)

+			hasResourcetoDelete = true

+		}

+		execution.setVariable("hasResourcetoDelete", hasResourcetoDelete)

 

-    }

+		if(hasResourcetoDelete) {

+			def jsonSlurper = new JsonSlurper()

+			String serviceRelationShip = execution.getVariable("serviceRelationShip")			

+			List relationShipList =  jsonSlurper.parseText(serviceRelationShip)

+

+			//Set the real resource instance id to the decomosed resource list

+			for(Resource resource: delResourceList){

+				//reset the resource instance id , because in the decompose flow ,its a random one.

+				resource.setResourceId("");

+				//match the resource-instance-name and the model name

+				if (relationShipList != null) {

+					relationShipList.each {

+						if(StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())){

+							resource.setResourceId(it.resourceInstanceId);

+						}

+					}

+				}

+			}

+		}

+		

+		execution.setVariable("deleteResourceList", delResourceList)

+

+		utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)

+	}

 

     public void postProcessForDeleteResource(DelegateExecution execution) {

         def isDebugEnabled=execution.getVariable("isDebugLogEnabled")

diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn
index ae84d89..b331878 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn
@@ -44,6 +44,7 @@
         <camunda:in source="serviceDecomposition_Original" target="serviceDecomposition_Original" />
         <camunda:in source="addResourceList" target="addResourceList" />
         <camunda:in source="delResourceList" target="delResourceList" />
+        <camunda:in source="serviceRelationShip" target="serviceRelationShip" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_04qwbbf</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
index 067012e..35cd039 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
@@ -240,11 +240,10 @@
         <camunda:in source="serviceType" target="serviceType" />
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:in source="URN_mso_workflow_sdncadapter_callback" target="URN_mso_workflow_sdncadapter_callback" />
-        <camunda:in source="serviceInputParams" target="serviceInputParams" />
-        <camunda:in source="delResourceList" target="deleteResourceList" />
-        <camunda:in source="resourceInstanceIDs" target="resourceInstanceIDs" />
+        <camunda:in source="deleteResourceList" target="deleteResourceList" />
         <camunda:in source="operationType" target="operationType" />
         <camunda:in source="operationId" target="operationId" />
+        <camunda:in source="serviceDecomposition_Original" target="serviceDecomposition" />
       </bpmn2:extensionElements>
       <bpmn2:incoming>SequenceFlow_0ur34hv</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0w4t4ao</bpmn2:outgoing>
@@ -252,15 +251,11 @@
     <bpmn2:sequenceFlow id="SequenceFlow_0w4t4ao" sourceRef="CallActivity_11obqi0" targetRef="ScriptTask_00wgfrc" />
     <bpmn2:callActivity id="CallActivity_07pl1uw" name="Call DoCreateResources" calledElement="DoCreateResourcesV3">
       <bpmn2:extensionElements>
-        <camunda:in source="nsServiceName" target="nsServiceName" />
         <camunda:in source="serviceDescription" target="nsServiceDescription" />
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
         <camunda:in source="serviceType" target="serviceType" />
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:in source="operationId" target="operationId" />
-        <camunda:in source="resourceType" target="resourceType" />
-        <camunda:in source="resourceUUID" target="resourceUUID" />
-        <camunda:in source="resourceParameters" target="resourceParameters" />
         <camunda:in source="operationType" target="operationType" />
         <camunda:in source="addResourceList" target="addResourceList" />
         <camunda:in source="serviceInstanceName" target="serviceInstanceName" />