Consolidate syncrounous and asyncronous APIs
[aai/gizmo.git] / src / main / java / org / onap / crud / service / AaiResourceService.java
index 98f83af..f7bda6a 100644 (file)
@@ -79,7 +79,7 @@ public class AaiResourceService {
   public static final String HTTP_PATCH_METHOD_OVERRIDE = "X-HTTP-Method-Override";\r
   \r
   private Auth auth;\r
-  CrudGraphDataService crudGraphDataService;\r
+  AbstractGraphDataService graphDataService;\r
   Gson gson = new Gson();\r
   \r
   private Logger logger      = LoggerFactory.getInstance().getLogger(AaiResourceService.class.getName());\r
@@ -94,9 +94,9 @@ public class AaiResourceService {
    * \r
    * @throws Exception\r
    */\r
-  public AaiResourceService(CrudGraphDataService crudGraphDataService) throws Exception {\r
-    this.crudGraphDataService = crudGraphDataService;\r
-    this.auth                 = new Auth(CrudServiceConstants.CRD_AUTH_FILE);\r
+  public AaiResourceService(AbstractGraphDataService graphDataService) throws Exception {\r
+    this.graphDataService = graphDataService;\r
+    this.auth = new Auth(CrudServiceConstants.CRD_AUTH_FILE);\r
   }\r
   \r
   /**\r
@@ -168,7 +168,7 @@ public class AaiResourceService {
         }\r
         \r
         // Now, create our edge in the graph store.\r
-        String result = crudGraphDataService.addEdge(RelationshipSchemaLoader.getLatestSchemaVersion(), type, payload);\r
+        String result = graphDataService.addEdge(RelationshipSchemaLoader.getLatestSchemaVersion(), type, payload);\r
         response = Response.status(Status.CREATED).entity(result).type(mediaType).build();\r
         \r
       } catch (CrudException e) {\r
@@ -232,7 +232,7 @@ public class AaiResourceService {
         payload = applyEdgeRulesToPayload(payload);\r
         \r
         // Now, create our edge in the graph store.\r
-        String result = crudGraphDataService.addEdge(RelationshipSchemaLoader.getLatestSchemaVersion(), payload.getType(), payload);\r
+        String result = graphDataService.addEdge(RelationshipSchemaLoader.getLatestSchemaVersion(), payload.getType(), payload);\r
         response = Response.status(Status.CREATED).entity(result).type(mediaType).build();\r
       \r
       } catch (CrudException ce) {\r
@@ -307,10 +307,10 @@ public class AaiResourceService {
         String result;\r
         if (headers.getRequestHeaders().getFirst(HTTP_PATCH_METHOD_OVERRIDE) != null &&\r
             headers.getRequestHeaders().getFirst(HTTP_PATCH_METHOD_OVERRIDE).equalsIgnoreCase("PATCH")) {\r
-          result = crudGraphDataService.patchEdge(RelationshipSchemaLoader.getLatestSchemaVersion(), id, type, payload);\r
+          result = graphDataService.patchEdge(RelationshipSchemaLoader.getLatestSchemaVersion(), id, type, payload);\r
         } else {\r
 \r
-          result = crudGraphDataService.updateEdge(RelationshipSchemaLoader.getLatestSchemaVersion(), id, type, payload);\r
+          result = graphDataService.updateEdge(RelationshipSchemaLoader.getLatestSchemaVersion(), id, type, payload);\r
         }\r
 \r
         response = Response.status(Status.OK).entity(result).type(mediaType).build();\r