From c87550c395bcb26bc9e6b4716cd2a25ae97694eb Mon Sep 17 00:00:00 2001 From: Venkata Harish K Kajur Date: Fri, 16 Jun 2017 17:04:44 -0400 Subject: [AAI-ONAP] Add missing named queries fix model del Add the missing thunderbolt named queries Fix model-based delete functionality Change-Id: Ib49f7a50cefff3a402eed1bfbfc716052ba91538 Signed-off-by: Venkata Harish K Kajur --- .../aai/dbgraphgen/ModelBasedProcessing.java | 6 ++-- .../org/openecomp/aai/dbgraphmap/SearchGraph.java | 34 ++++++++++------------ 2 files changed, 19 insertions(+), 21 deletions(-) (limited to 'aai-traversal/src/main/java') diff --git a/aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessing.java b/aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessing.java index da1fc1e..d3b44a3 100644 --- a/aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessing.java +++ b/aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessing.java @@ -2593,10 +2593,10 @@ public class ModelBasedProcessing{ String emsg = " Unrecognized nodeType bb [" + nodeTypeB + "]\n"; throw new AAIException("AAI_6115", emsg); } - } else { - String msg = " No Edge Rule found for this pair of nodeTypes (order does not matter) [" + + String msg = " No Edge Rule found for this pair of nodeTypes (order does not matter) [" + nodeTypeA + "], [" + nodeTypeB + "]."; - throw new AAIException("AAI_6120", msg); + throw new AAIException("AAI_6120", msg); } diff --git a/aai-traversal/src/main/java/org/openecomp/aai/dbgraphmap/SearchGraph.java b/aai-traversal/src/main/java/org/openecomp/aai/dbgraphmap/SearchGraph.java index d9e40c4..8821f07 100644 --- a/aai-traversal/src/main/java/org/openecomp/aai/dbgraphmap/SearchGraph.java +++ b/aai-traversal/src/main/java/org/openecomp/aai/dbgraphmap/SearchGraph.java @@ -453,7 +453,7 @@ public class SearchGraph { boolean isParallel = stream.isParallel(); stream.forEach(v -> { String nodeType = v.property(AAIProperties.NODE_TYPE).orElse(null); - + String thisNodeURL; try { thisNodeURL = urlBuilder.pathed(v); @@ -471,7 +471,7 @@ public class SearchGraph { } catch (AAIException | AAIFormatVertexException e) { throw new RuntimeException(e); } - + }); return searchResults; } @@ -667,7 +667,7 @@ public class SearchGraph { } DynamicEntity modelAndNamedQuerySearch = (DynamicEntity)loader.unmarshal("ModelAndNamedQuerySearch", queryParameters, mediaType).getUnderlyingObject(); - if (modelAndNamedQuerySearch == null) { + if (modelAndNamedQuerySearch == null) { throw new AAIException("AAI_5105"); } if (modelAndNamedQuerySearch == null) { @@ -758,6 +758,13 @@ public class SearchGraph { ResultSet rs = resultSet.get(0); TitanVertex firstVert = rs.getVert(); + String restURI = serializer.getURIForVertex(firstVert).toString(); + String notificationVersion = AAIProperties.LATEST.toString(); + if (restURI.startsWith("/")) { + restURI = "/aai/" + notificationVersion + restURI; + } else { + restURI = "/aai/" + notificationVersion + "/" + restURI; + } Map delResult = processor.runDeleteByModel( transId, fromAppId, modelVersionId, topNodeType, startNodeFilterHash.get(0), aaiExtMap.getApiVersion(), resourceVersion ); @@ -768,25 +775,16 @@ public class SearchGraph { } resultStr.trim(); - DynamicEntity inventoryItems = jaxbContext.newDynamicEntity("inventory.aai.openecomp.org." + aaiExtMap.getApiVersion() + ".InventoryResponseItems"); + DynamicEntity inventoryItems = jaxbContext.newDynamicEntity("inventory.aai.att.com." + aaiExtMap.getApiVersion() + ".InventoryResponseItems"); DynamicEntity topInvItem = remapInventoryItems((DynamicEntity)invItemList.get(0), jaxbContext, delResult, objectToVertMap, aaiExtMap); - List newInvItemList = new ArrayList(); + newInvItemList.add(topInvItem); inventoryItems.set("inventoryResponseItem", newInvItemList); - String notificationVersion = AAIProperties.LATEST.toString(); - - String restURI = serializer.getURIForVertex(firstVert).toString(); - if (restURI.startsWith("/")) { - restURI = "/aai/" + notificationVersion + restURI; - } else { - restURI = "/aai/" + notificationVersion + "/" + restURI; - } DynamicEntity notificationHeader = (DynamicEntity) loader.introspectorFromName("notification-event-header").getUnderlyingObject(); notificationHeader.set("entityLink", restURI); - notificationHeader.set("action", "DELETE"); - + notificationHeader.set("action", "DELETE"); notificationHeader.set("entityType", "inventory-response-items"); notificationHeader.set("topEntityType", "inventory-response-items"); notificationHeader.set("sourceName", aaiExtMap.getFromAppId()); @@ -945,7 +943,7 @@ public class SearchGraph { Map includeTheseVertices, Map objectToVertMap, AAIExtensionMap aaiExtMap) { - DynamicEntity inventoryItem = jaxbContext.newDynamicEntity("inventory.aai.openecomp.org." + aaiExtMap.getApiVersion() + ".InventoryResponseItem"); + DynamicEntity inventoryItem = jaxbContext.newDynamicEntity("inventory.aai.att.com." + aaiExtMap.getApiVersion() + ".InventoryResponseItem"); Object item = invResultItem.get("item"); inventoryItem.set("modelName", invResultItem.get("modelName")); inventoryItem.set("item", item); @@ -960,7 +958,7 @@ public class SearchGraph { if (includeTheseVertices.containsKey(vertexId)) { if (invResultItem.isSet("inventoryResponseItems")) { List invItemList = new ArrayList(); - DynamicEntity inventoryItems = jaxbContext.newDynamicEntity("inventory.aai.openecomp.org." + aaiExtMap.getApiVersion() + ".InventoryResponseItems"); + DynamicEntity inventoryItems = jaxbContext.newDynamicEntity("inventory.aai.att.com." + aaiExtMap.getApiVersion() + ".InventoryResponseItems"); DynamicEntity subInventoryResponseItems = invResultItem.get("inventoryResponseItems"); List subInventoryResponseItemList = subInventoryResponseItems.get("inventoryResponseItem"); for (DynamicEntity ent : subInventoryResponseItemList) { @@ -1016,7 +1014,7 @@ public class SearchGraph { String aaiNodeType = vert.property("aai-node-type").orElse(null); - + if (aaiNodeType != null) { Introspector thisObj = loader.introspectorFromName(aaiNodeType); -- cgit 1.2.3-korg