aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-04-14 10:49:49 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-14 10:49:49 +0000
commitf5a7e49a14496164f894c942ab8209d004e6c1dd (patch)
tree2d7d070fa46cccae65669c5820a3b9032f4cc799 /bpmn/MSOInfrastructureBPMN/src
parent83efc4a66030965ecca59a25d1085c4ff54d66bb (diff)
parent5b82bcab5593479a28649fd82d30f18d12d09771 (diff)
Merge "Fix parsing from AAI response"
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy30
1 files changed, 19 insertions, 11 deletions
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 1c8a5e70fe..003210f602 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
@@ -187,6 +187,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
else
{
+ InputSource source = new InputSource(new StringReader(siData));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document serviceXml = docBuilder.parse(source)
+ serviceXml.getDocumentElement().normalize()
// get model invariant id
// Get Template uuid and version
if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
@@ -203,13 +208,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
//Confirm there are no related service instances (vnf/network or volume)
if (utils.nodeExists(siData, "relationship-list")) {
utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
- InputSource source = new InputSource(new StringReader(siData));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document serviceXml = docBuilder.parse(source)
- serviceXml.getDocumentElement().normalize()
//test(siData)
- NodeList nodeList = serviceXml.getElementsByTagName("relationship")
+ NodeList nodeList = serviceXml.getElementsByTagName("relationship").item(0).getChildNodes()
JSONArray jArray = new JSONArray()
for (int x = 0; x < nodeList.getLength(); x++) {
Node node = nodeList.item(x)
@@ -225,12 +225,20 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
for (int i = 0; i < dataList.getLength(); i++) {
Node dNode = dataList.item(i)
if(dNode.getNodeName() == "relationship-data") {
- 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)
+
+ 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)
+ }
+ }
}
+
}
else if(dNode.getNodeName() == "related-to-property"){
Element rDataEle = (Element)dNode