From 6fff64a3138d347b961e59c0996d85093c6fa930 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 10 Nov 2017 17:01:00 -0500 Subject: Changed parsing code in DoDeleteVfModuleFromVnf Modified code to use MsoUtils to parse the xml rather than walking the nodes generated by documentBuilder. Added check for missing vfModuleOutputs. Added MsoUtils.getMultNodeObjects() to return real Node objects instead of lazy nodes. Change-Id: I0266502f1e0353c778dce982fa55cf7ce944d91e Issue-Id: SO-333 Signed-off-by: Jim Hahn --- .../org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy index 94b423669d..06992455a2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy @@ -59,6 +59,21 @@ class MsoUtils { } return nodes } + /** + * Note: this uses XmlParser instead of XmlSlurper, thus it is not as + * efficient because it instantiates the whole DOM tree. + * @param xmlInput + * @param element + * @return a list of Nodes, or {@code null} if xmlInput is {@code null} + */ + def getMultNodeObjects(xmlInput, element){ + def nodes=null + if(xmlInput!=null){ + def xml= new XmlParser().parseText(xmlInput) + nodes = xml.'**'.findAll{ node-> node.name() == element } + } + return nodes + } def getNodeText1(xmlInput,element){ def rtn=null if(xmlInput!=null){ -- cgit 1.2.3-korg