summaryrefslogtreecommitdiffstats
path: root/aai-traversal/src/main/java/org/openecomp
diff options
context:
space:
mode:
authorMuller, Andrew (am8383) <am8383@us.att.com>2017-08-11 15:20:22 -0400
committerVenkata Harish K Kajur <vk250x@att.com>2017-08-08 00:42:29 +0000
commit475beb0e12a1a36deac965a9197ba9af966b6c8a (patch)
tree87ee10a71a7fc08bd8a8cb1f22349d8882bc10fa /aai-traversal/src/main/java/org/openecomp
parent072afa5431c667dc979763af76e82de27450350c (diff)
[AAI-154 Amsterdam] Check in titan refactor
Change-Id: I136eca1c2dbc337f9f6019e52cfe60b15ebfbe7d Signed-off-by: Muller, Andrew (am8383) <am8383@us.att.com>
Diffstat (limited to 'aai-traversal/src/main/java/org/openecomp')
-rw-r--r--aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ModelBasedProcessing.java7
-rw-r--r--aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ResultSet.java8
-rw-r--r--aai-traversal/src/main/java/org/openecomp/aai/dbgraphmap/SearchGraph.java28
-rw-r--r--aai-traversal/src/main/java/org/openecomp/aai/extensions/AAIExtensionMap.java17
-rw-r--r--aai-traversal/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java4
5 files changed, 27 insertions, 37 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 d3b44a3..282f5d3 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
@@ -58,7 +58,6 @@ import com.google.common.collect.Multimap;
import com.google.common.util.concurrent.SimpleTimeLimiter;
import com.google.common.util.concurrent.TimeLimiter;
import com.google.common.util.concurrent.UncheckedTimeoutException;
-import com.thinkaurelius.titan.core.TitanVertex;
/**
* Utility class that uses Model/Named-Query definitions to navigate the graph.
@@ -824,13 +823,13 @@ public class ModelBasedProcessing{
return retHash;
}
- TitanVertex thisVtx = resSet.getVert();
+ Vertex thisVtx = resSet.getVert();
String thisGuyId = "";
String thisNT = "";
String thisGuyStr = "";
try {
- if( thisVtx != null && !thisVtx.isRemoved() ){
+ if( thisVtx != null){
thisGuyId = thisVtx.id().toString();
thisNT = thisVtx.<String>property(AAIProperties.NODE_TYPE).orElse(null);
thisGuyStr = thisGuyId + "[" + thisNT + " found at:" + resSet.getLocationInModelSubGraph() + "]";
@@ -1488,7 +1487,7 @@ public class ModelBasedProcessing{
rs.setExtraPropertyHash(tmpExtraPropHash);
}
- rs.setVert((TitanVertex)thisLevelElemVtx);
+ rs.setVert(thisLevelElemVtx);
rs.setLocationInModelSubGraph(thisVertsTrail);
if( delKeyHash.containsKey(thisVertsTrail) && delKeyHash.get(thisVertsTrail).equals("T") ){
rs.setNewDataDelFlag("T");
diff --git a/aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ResultSet.java b/aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ResultSet.java
index 46c9b5e..c66772d 100644
--- a/aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ResultSet.java
+++ b/aai-traversal/src/main/java/org/openecomp/aai/dbgraphgen/ResultSet.java
@@ -25,11 +25,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.aai.dbgen.PropertyLimitDesc;
-import com.thinkaurelius.titan.core.TitanVertex;
public class ResultSet {
- private TitanVertex vert;
+ private Vertex vert;
private String newDataDelFlag;
private String doNotOutputFlag;
private String locationInModelSubGraph;
@@ -62,7 +62,7 @@ public class ResultSet {
*
* @return the vert
*/
- public TitanVertex getVert(){
+ public Vertex getVert(){
return this.vert;
}
@@ -130,7 +130,7 @@ public class ResultSet {
}
- public void setVert(TitanVertex vert) {
+ public void setVert(Vertex vert) {
this.vert = vert;
}
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 8821f07..e68ab1a 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
@@ -77,8 +77,6 @@ import org.openecomp.aai.util.StoreNotificationEvent;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.google.common.base.CaseFormat;
-import com.thinkaurelius.titan.core.TitanTransaction;
-import com.thinkaurelius.titan.core.TitanVertex;
import edu.emory.mathcs.backport.java.util.Collections;
@@ -519,7 +517,6 @@ public class SearchGraph {
Introspector inventoryItems;
boolean success = true;
- TitanTransaction g = null;
TransactionalGraphEngine dbEngine = null;
try {
@@ -532,7 +529,7 @@ public class SearchGraph {
DBSerializer serializer = new DBSerializer(AAIProperties.LATEST, dbEngine, ModelType.MOXY, fromAppId);
ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
- g = dbEngine.startTransaction();
+ dbEngine.startTransaction();
org.openecomp.aai.restcore.MediaType mediaType = org.openecomp.aai.restcore.MediaType.APPLICATION_JSON_TYPE;
String contentType = aaiExtMap.getHttpServletRequest().getContentType();
if (contentType != null && contentType.contains("application/xml")) {
@@ -609,11 +606,11 @@ public class SearchGraph {
success = false;
throw new AAIException("AAI_5105", e);
} finally {
- if (g != null) {
+ if (dbEngine != null) {
if (success) {
- g.commit();
+ dbEngine.commit();
} else {
- g.rollback();
+ dbEngine.rollback();
}
}
}
@@ -641,7 +638,6 @@ public class SearchGraph {
AAIExtensionMap aaiExtMap) throws JAXBException, AAIException, DynamicException, UnsupportedEncodingException {
Response response;
boolean success = true;
- TitanTransaction g = null;
TransactionalGraphEngine dbEngine = null;
try {
@@ -653,7 +649,7 @@ public class SearchGraph {
loader);
DBSerializer serializer = new DBSerializer(AAIProperties.LATEST, dbEngine, ModelType.MOXY, fromAppId);
ModelBasedProcessing processor = new ModelBasedProcessing(loader, dbEngine, serializer);
- g = dbEngine.startTransaction();
+ dbEngine.startTransaction();
org.openecomp.aai.restcore.MediaType mediaType = org.openecomp.aai.restcore.MediaType.APPLICATION_JSON_TYPE;
@@ -757,7 +753,7 @@ public class SearchGraph {
ResultSet rs = resultSet.get(0);
- TitanVertex firstVert = rs.getVert();
+ Vertex firstVert = rs.getVert();
String restURI = serializer.getURIForVertex(firstVert).toString();
String notificationVersion = AAIProperties.LATEST.toString();
if (restURI.startsWith("/")) {
@@ -816,11 +812,11 @@ public class SearchGraph {
success = false;
throw new AAIException("AAI_5105", e);
} finally {
- if (g != null) {
+ if (dbEngine != null) {
if (success) {
- g.commit();
+ dbEngine.commit();
} else {
- g.rollback();
+ dbEngine.rollback();
}
}
}
@@ -1007,14 +1003,10 @@ public class SearchGraph {
// add this inventoryItem to the resultList for this level
resultList.add(inventoryItem.getUnderlyingObject());
- TitanVertex vert = resultSet.getVert();
-
- Long vertId = (Long)vert.longId();
+ Vertex vert = resultSet.getVert();
String aaiNodeType = vert.<String>property("aai-node-type").orElse(null);
-
-
if (aaiNodeType != null) {
Introspector thisObj = loader.introspectorFromName(aaiNodeType);
diff --git a/aai-traversal/src/main/java/org/openecomp/aai/extensions/AAIExtensionMap.java b/aai-traversal/src/main/java/org/openecomp/aai/extensions/AAIExtensionMap.java
index 167dae4..d61aa6c 100644
--- a/aai-traversal/src/main/java/org/openecomp/aai/extensions/AAIExtensionMap.java
+++ b/aai-traversal/src/main/java/org/openecomp/aai/extensions/AAIExtensionMap.java
@@ -28,15 +28,14 @@ import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.UriInfo;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-
import org.openecomp.aai.domain.responseMessage.AAIResponseMessages;
import org.openecomp.aai.introspection.Loader;
import org.openecomp.aai.rest.db.DBRequest;
import org.openecomp.aai.rest.db.HttpEntry;
import org.openecomp.aai.serialization.engines.TransactionalGraphEngine;
-import com.thinkaurelius.titan.core.TitanTransaction;
-import com.thinkaurelius.titan.core.TitanVertex;
public class AAIExtensionMap {
// =======================================================================
@@ -95,13 +94,13 @@ public class AAIExtensionMap {
private boolean postExtSkipErrorCallback = true;
private String fromAppId;
private String transId;
- private TitanTransaction graph;
+ private Graph graph;
private Object objectFromResponse;
private HashMap<String, Object> lookupHashMap;
private HashMap<String, ArrayList<String>> precheckAddedList;
private AAIResponseMessages precheckResponseMessages;
private HashMap<String, Object> topology;
- private HashMap<String, TitanVertex> vertexCache;
+ private HashMap<String, Vertex> vertexCache;
private String baseObject;
private String namespace;
private String fullResourceName;
@@ -435,7 +434,7 @@ public class AAIExtensionMap {
*
* @return the graph
*/
- public TitanTransaction getGraph() {
+ public Graph getGraph() {
return graph;
}
@@ -444,7 +443,7 @@ public class AAIExtensionMap {
*
* @param graph the new graph
*/
- public void setGraph(TitanTransaction graph) {
+ public void setGraph(Graph graph) {
this.graph = graph;
}
@@ -546,9 +545,9 @@ public class AAIExtensionMap {
*
* @return the vertex cache
*/
- public HashMap<String, TitanVertex> getVertexCache() {
+ public HashMap<String, Vertex> getVertexCache() {
if (this.vertexCache == null) {
- this.vertexCache = new HashMap<String, TitanVertex>();
+ this.vertexCache = new HashMap<String, Vertex>();
}
return vertexCache;
}
diff --git a/aai-traversal/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java b/aai-traversal/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java
index 60438de..36b82b7 100644
--- a/aai-traversal/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java
+++ b/aai-traversal/src/main/java/org/openecomp/aai/rest/db/HttpEntry.java
@@ -39,6 +39,7 @@ import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.lang.StringUtils;
+import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.javatuples.Pair;
@@ -75,7 +76,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.fge.jsonpatch.JsonPatchException;
import com.github.fge.jsonpatch.mergepatch.JsonMergePatch;
import com.thinkaurelius.titan.core.TitanException;
-import com.thinkaurelius.titan.core.TitanTransaction;
/**
* The Class HttpEntry.
@@ -499,7 +499,7 @@ public class HttpEntry {
* @throws UnsupportedEncodingException the unsupported encoding exception
* @throws AAIException the AAI exception
*/
- private Response invokeExtension(TransactionalGraphEngine dbEngine, TitanTransaction g, HttpMethod httpMethod, DBRequest request, String fromAppId, Version apiVersion, Loader loader, Introspector obj, URI uri, boolean isPreprocess) throws IllegalArgumentException, UnsupportedEncodingException, AAIException {
+ private Response invokeExtension(TransactionalGraphEngine dbEngine, Graph g, HttpMethod httpMethod, DBRequest request, String fromAppId, Version apiVersion, Loader loader, Introspector obj, URI uri, boolean isPreprocess) throws IllegalArgumentException, UnsupportedEncodingException, AAIException {
AAIExtensionMap aaiExtMap = new AAIExtensionMap();
ModelInjestor injestor = ModelInjestor.getInstance();
Response response = null;