X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fgizmo.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fcrud%2Fservice%2FAbstractGraphDataService.java;h=5ad4b7d8e963ee0e81fe15e0ad2edfbc3694a8da;hp=1163623e07582073ba4e912e3655a82195220cc3;hb=74879a7b7a5607c89aef5fa9d64aca5ddea8e3b7;hpb=1bb61ff3e013bcd41beffc5d9f01964f422f8a9e 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 filter) throws CrudException { RelationshipSchemaValidator.validateType(version, type); - List items = dao.getEdges(type, RelationshipSchemaValidator.resolveCollectionfilter(version, type, filter)); + List 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 edges = dao.getVertexEdges(id); + Vertex vertex = daoForGet.getVertex(id, type, version); + List edges = daoForGet.getVertexEdges(id); return CrudResponseBuilder.buildGetVertexResponse(OxmModelValidator.validateOutgoingPayload(version, vertex), edges, version); } public String getVertices(String version, String type, Map filter, HashSet properties) throws CrudException { type = OxmModelValidator.resolveCollectionType(version, type); - List items = dao.getVertices(type, OxmModelValidator.resolveCollectionfilter(version, type, filter), properties); + List 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 vertices = new HashMap(); HashMap edges = new HashMap(); - + 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; + }