summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorShwetank Dave <shwetank.dave@amdocs.com>2018-12-24 12:32:42 -0500
committerShwetank Dave <shwetank.dave@amdocs.com>2018-12-24 12:35:21 -0500
commitc919bbafb8163529c56588f06caee60d1d87356f (patch)
treeece5b4561471ac3d1a5feb52f84489257ad62f68 /src/main
parentd51609df415b6483598c54a8fc27b66731690416 (diff)
Fix bug in gixmo interface
Change-Id: I75a6d3fdde11359aa834113c97f9b35a8744e902 Issue-ID: AAI-1957 Signed-off-by: Shwetank Dave <shwetank.dave@amdocs.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/aai/modelloader/util/GizmoTranslator.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/main/java/org/onap/aai/modelloader/util/GizmoTranslator.java b/src/main/java/org/onap/aai/modelloader/util/GizmoTranslator.java
index cb08a25..2f4469f 100644
--- a/src/main/java/org/onap/aai/modelloader/util/GizmoTranslator.java
+++ b/src/main/java/org/onap/aai/modelloader/util/GizmoTranslator.java
@@ -2,8 +2,8 @@
* ============LICENSE_START==========================================
* org.onap.aai
* ===================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,6 +63,8 @@ public class GizmoTranslator {
private static Logger logger = LoggerFactory.getInstance().getLogger(GizmoTranslator.class.getName());
public static String translate(String xmlPayload) throws ParserConfigurationException, SAXException, IOException {
+ logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Process XML model artifact: " + xmlPayload);
+
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
DocumentBuilder builder = factory.newDocumentBuilder();
@@ -202,6 +204,28 @@ public class GizmoTranslator {
private static String generateModelElementId(Element node) {
Set<String> elemSet = new HashSet<>();
+ // Get the parent model version / named query version
+ String parentVersion = null;
+ Node parentNode = node.getParentNode();
+ while ( (parentNode != null) && (parentVersion == null) ) {
+ if (getNodeType(parentNode).equals(NodeType.VERTEX)) {
+ NodeList childNodes = ((Element)parentNode).getElementsByTagName("*");
+ for (int ix = 0; ix < childNodes.getLength(); ix++) {
+ if (childNodes.item(ix).getNodeName().equalsIgnoreCase("named-query-uuid") ||
+ childNodes.item(ix).getNodeName().equalsIgnoreCase("model-version-id")) {
+ parentVersion = childNodes.item(ix).getTextContent().trim();
+ break;
+ }
+ }
+ }
+
+ parentNode = parentNode.getParentNode();
+ }
+
+ if (parentVersion != null) {
+ elemSet.add(parentVersion);
+ }
+
NodeList childNodes = node.getElementsByTagName("*");
for (int ix = 0; ix < childNodes.getLength(); ix++) {
NodeType nt = getNodeType(childNodes.item(ix));