aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkata Harish K Kajur <vk250x@att.com>2017-08-22 10:13:14 -0400
committerVenkata Harish K Kajur <vk250x@att.com>2017-08-22 10:13:21 -0400
commit36bf6cd15438c1ba321018264deec36247f1b82d (patch)
treef18f3b568c779b6c6168e9180be33b8a80f78ca0
parent724086e36cabf6fb53285260fada6afe0280c571 (diff)
Fix Model based delete failing bug
Issue-ID: AAI-206 Change-Id: If69f34b9527e4e21a4ddacd32d3591f3f591da05 Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
-rw-r--r--aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessing.java18
-rw-r--r--aai-traversal/src/main/java/org/openecomp/aai/dbgraphmap/SearchGraph.java21
2 files changed, 17 insertions, 22 deletions
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 282f5d3..9b65ca1 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
@@ -828,20 +828,32 @@ public class ModelBasedProcessing{
String thisNT = "";
String thisGuyStr = "";
+ Boolean gotVtxOK = false;
try {
- if( thisVtx != null){
+ if( thisVtx != null ){
thisGuyId = thisVtx.id().toString();
thisNT = thisVtx.<String>property(AAIProperties.NODE_TYPE).orElse(null);
thisGuyStr = thisGuyId + "[" + thisNT + " found at:" + resSet.getLocationInModelSubGraph() + "]";
+
+ // NOTE -- will try to set the NodeType to itself to see if the node has been deleted already in
+ // this transaction. It lets you get properties from nodes being deleted where the
+ // delete hasn't been committed yet. This check used to be accomplished with a call to
+ // "vtx.isRemoved()" but that was a Titan-only feature and is not available anymore since
+ // we no longer use Titan vertices.
+ // If we don't do this check, we get errors later when we try to delete the node.
+ thisVtx.property(AAIProperties.NODE_TYPE, thisNT);
+ gotVtxOK = true;
}
}
catch (Exception ex) {
// Sometimes things have already been deleted by the time we get to them - just log it.
- LOGGER.warn("Exception when deleting " + thisGuyStr + ". msg = " + ex.getMessage(), ex);
+ LOGGER.warn("Exception when trying to delete: " + thisGuyStr + ". msg = " + ex.getMessage(), ex);
}
- if( thisGuyId.equals("") ){
+ if( !gotVtxOK ){
// The vertex must have already been removed. Just return.
+ // Note - We need to catch this because the DB sometimes can still have the vtx
+ // and be able to get its ID but it is flagged internally as removed already.
return retHash;
}
else {
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 58c4d1d..b8581d1 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
@@ -757,7 +757,7 @@ public class SearchGraph {
} else {
restURI = "/aai/" + notificationVersion + "/" + restURI;
}
-
+
Map<String,String> delResult = processor.runDeleteByModel( transId, fromAppId,
modelVersionId, topNodeType, startNodeFilterHash.get(0), aaiExtMap.getApiVersion(), resourceVersion );
@@ -767,24 +767,7 @@ public class SearchGraph {
}
resultStr.trim();
- DynamicEntity inventoryItems = jaxbContext.newDynamicEntity("inventory.aai.att.com." + aaiExtMap.getApiVersion() + ".InventoryResponseItems");
- DynamicEntity topInvItem = remapInventoryItems((DynamicEntity)invItemList.get(0), jaxbContext, delResult, objectToVertMap, aaiExtMap);
- List<DynamicEntity> newInvItemList = new ArrayList<DynamicEntity>();
-
- newInvItemList.add(topInvItem);
- inventoryItems.set("inventoryResponseItem", newInvItemList);
-
- DynamicEntity notificationHeader = (DynamicEntity) loader.introspectorFromName("notification-event-header").getUnderlyingObject();
- notificationHeader.set("entityLink", restURI);
- notificationHeader.set("action", "DELETE");
- notificationHeader.set("entityType", "inventory-response-items");
- notificationHeader.set("topEntityType", "inventory-response-items");
- notificationHeader.set("sourceName", aaiExtMap.getFromAppId());
- notificationHeader.set("version", notificationVersion);
-
- StoreNotificationEvent sne = new StoreNotificationEvent(transId, fromAppId);
-
- sne.storeDynamicEvent(loader.getJAXBContext(), notificationVersion, notificationHeader, inventoryItems);
+ // Note - notifications are now done down in the individual "remove" calls done in runDeleteByModel() above.
response = Response.ok(resultStr).build();