aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/crud/service/AbstractGraphDataService.java
diff options
context:
space:
mode:
authorTian Lee <TianL@amdocs.com>2018-02-01 16:02:43 +0000
committerGerrit Code Review <gerrit@onap.org>2018-02-01 16:02:43 +0000
commit4a574e5f3824069de897b9ff9b8c346b5b4dceef (patch)
tree8d26e04ff69e24a24b61d46ad4623e817401f1fb /src/main/java/org/onap/crud/service/AbstractGraphDataService.java
parent56f24334a64166ad1bae43f1b8d1b9e1e3c7e2d7 (diff)
parent74879a7b7a5607c89aef5fa9d64aca5ddea8e3b7 (diff)
Merge "Config to be able to route GET through datarouter"
Diffstat (limited to 'src/main/java/org/onap/crud/service/AbstractGraphDataService.java')
-rw-r--r--src/main/java/org/onap/crud/service/AbstractGraphDataService.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/org/onap/crud/service/AbstractGraphDataService.java b/src/main/java/org/onap/crud/service/AbstractGraphDataService.java
index 1163623..5ad4b7d 100644
--- a/src/main/java/org/onap/crud/service/AbstractGraphDataService.java
+++ b/src/main/java/org/onap/crud/service/AbstractGraphDataService.java
@@ -44,45 +44,44 @@ import org.onap.schema.RelationshipSchemaValidator;
import com.google.gson.JsonElement;
public abstract class AbstractGraphDataService {
+ protected GraphDao daoForGet;
protected GraphDao dao;
- public AbstractGraphDataService(GraphDao dao) throws CrudException {
- this.dao = dao;
-
+ public AbstractGraphDataService() throws CrudException {
CrudServiceUtil.loadModels();
}
public String getEdge(String version, String id, String type) throws CrudException {
RelationshipSchemaValidator.validateType(version, type);
- Edge edge = dao.getEdge(id, type);
+ Edge edge = daoForGet.getEdge(id, type);
return CrudResponseBuilder.buildGetEdgeResponse(RelationshipSchemaValidator.validateOutgoingPayload(version, edge), version);
}
public String getEdges(String version, String type, Map<String, String> filter) throws CrudException {
RelationshipSchemaValidator.validateType(version, type);
- List<Edge> items = dao.getEdges(type, RelationshipSchemaValidator.resolveCollectionfilter(version, type, filter));
+ List<Edge> items = daoForGet.getEdges(type, RelationshipSchemaValidator.resolveCollectionfilter(version, type, filter));
return CrudResponseBuilder.buildGetEdgesResponse(items, version);
}
public String getVertex(String version, String id, String type) throws CrudException {
type = OxmModelValidator.resolveCollectionType(version, type);
- Vertex vertex = dao.getVertex(id, type, version);
- List<Edge> edges = dao.getVertexEdges(id);
+ Vertex vertex = daoForGet.getVertex(id, type, version);
+ List<Edge> edges = daoForGet.getVertexEdges(id);
return CrudResponseBuilder.buildGetVertexResponse(OxmModelValidator.validateOutgoingPayload(version, vertex), edges,
version);
}
public String getVertices(String version, String type, Map<String, String> filter, HashSet<String> properties) throws CrudException {
type = OxmModelValidator.resolveCollectionType(version, type);
- List<Vertex> items = dao.getVertices(type, OxmModelValidator.resolveCollectionfilter(version, type, filter), properties);
+ List<Vertex> items = daoForGet.getVertices(type, OxmModelValidator.resolveCollectionfilter(version, type, filter), properties);
return CrudResponseBuilder.buildGetVerticesResponse(items, version);
}
public String addBulk(String version, BulkPayload payload, HttpHeaders headers) throws CrudException {
HashMap<String, Vertex> vertices = new HashMap<String, Vertex>();
HashMap<String, Edge> edges = new HashMap<String, Edge>();
-
+
String txId = dao.openTransaction();
try {
@@ -269,4 +268,5 @@ public abstract class AbstractGraphDataService {
protected abstract Edge addBulkEdge(Edge edge, String version, String dbTransId) throws CrudException;
protected abstract Edge updateBulkEdge(Edge edge, String version, String dbTransId) throws CrudException;
protected abstract void deleteBulkEdge(String id, String version, String type, String dbTransId) throws CrudException;
+
}