Update resource UUids for resource status

Update resource UUids for resource status

Change-Id: I37bd5f9c6a2b30695b39e78dc64ab219831a3828
Issue-ID: SO-587
Signed-off-by: c00149107 <chenchuanyu@huawei.com>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index d44de7c..71aea02 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -209,7 +209,7 @@
                     if (utils.nodeExists(siData, "relationship-list")) {
                         utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
                         //test(siData)
-                        NodeList nodeList = serviceXml.getElementsByTagName("relationship").item(0).getChildNodes()
+                        NodeList nodeList = serviceXml.getElementsByTagName("relationship")
                         JSONArray jArray = new JSONArray()
                         for (int x = 0; x < nodeList.getLength(); x++) {
                             Node node = nodeList.item(x)
@@ -225,18 +225,11 @@
                                         for (int i = 0; i < dataList.getLength(); i++) {
                                             Node dNode = dataList.item(i)
                                             if(dNode.getNodeName() == "relationship-data") {
-
-                                                NodeList rdNodes = dNode.getChildNodes()
-                                                for(int j = 0; j < rdNodes.getLength(); j++) {
-                                                    Node rdNode = rdNodes.item(j);
-                                                    if (rdNode instanceof Element) {
-                                                        Element rDataEle = (Element) rdNode
-                                                        def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
-                                                        def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
-                                                        if (eKey.equals("service-instance.service-instance-id")) {
-                                                            jObj.put("resourceInstanceId", eValue)
-                                                        }
-                                                    }
+                                                Element rDataEle = (Element)dNode
+                                                def eKey =  rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
+                                                def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
+                                                if(eKey.equals("service-instance.service-instance-id")){
+                                                    jObj.put("resourceInstanceId", eValue)
                                                 }
 
                                             }
@@ -342,8 +335,8 @@
             //here modelVersion is not set, we use modelUuid to decompose the service.
             String serviceModelInfo = """{
             "modelInvariantUuid":"${modelInvariantUuid}",
-            "modelUuid":"",
-            "modelVersion":"${modelVersionId}"
+            "modelUuid":"${modelVersionId}",
+            "modelVersion":""
              }"""
             execution.setVariable("serviceModelInfo", serviceModelInfo)
 
@@ -390,18 +383,14 @@
             execution.setVariable("serviceInstanceId", serviceId)
             execution.setVariable("operationId", operationId)
             execution.setVariable("operationType", operationType)
+            List<Resource> deleteResourceList = execution.getVariable("deleteResourceList")
 
-            String serviceRelationShip = execution.getVariable("serviceRelationShip")
-
-            def jsonSlurper = new JsonSlurper()
-            def jsonOutput = new JsonOutput()
-            List relationShipList =  jsonSlurper.parseText(serviceRelationShip)
-
-            if (relationShipList != null) {
-                relationShipList.each {
-                    resourceTemplateUUIDs  = resourceTemplateUUIDs + it.resourceInstanceId + ":"
-                }
-            }
+            String serviceRelationShip = execution.getVariable("serviceRelationShip")                    
+            for(Resource resource : deleteResourceList){
+                    resourceTemplateUUIDs  = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
+            }   
+            
+            
             execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
 
             String payload =