Add event client dependency
[aai/gizmo.git] / src / main / java / org / onap / crud / service / CrudAsyncGraphDataService.java
index 60a18d3..d674d0e 100644 (file)
@@ -23,8 +23,8 @@
  */
 package org.onap.crud.service;
 
-import com.att.ecomp.event.api.EventConsumer;
-import com.att.ecomp.event.api.EventPublisher;
+import org.onap.aai.event.api.EventConsumer;
+import org.onap.aai.event.api.EventPublisher;
 
 import org.onap.aai.cl.api.LogFields;
 import org.onap.aai.cl.api.Logger;
@@ -48,6 +48,7 @@ import org.onap.schema.OxmModelValidator;
 import org.onap.schema.RelationshipSchemaValidator;
 
 import java.text.SimpleDateFormat;
+import java.util.HashMap;
 import java.util.Timer;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
@@ -84,12 +85,21 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService {
   public static Integer getRequestTimeOut() {
     return requestTimeOut;
   }
+  
+  public CrudAsyncGraphDataService(GraphDao dao, 
+          EventPublisher asyncRequestPublisher,
+          EventConsumer asyncResponseConsumer) throws CrudException {
+      this(dao,dao,asyncRequestPublisher,asyncResponseConsumer);
+  }
 
   public CrudAsyncGraphDataService(GraphDao dao, 
+          GraphDao daoForGet, 
                  EventPublisher asyncRequestPublisher,
                  EventConsumer asyncResponseConsumer) throws CrudException {
 
-     super(dao);
+    super();
+    this.dao = dao;
+    this.daoForGet = daoForGet;
      
     requestTimeOut = DEFAULT_REQUEST_TIMEOUT;
     try {
@@ -261,7 +271,7 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService {
   public String patchVertex(String version, String id, String type, VertexPayload payload)
     throws CrudException {
     Vertex existingVertex
-      = dao.getVertex(id, OxmModelValidator.resolveCollectionType(version, type));
+      = dao.getVertex(id, OxmModelValidator.resolveCollectionType(version, type), version, new HashMap<String, String>());
     Vertex patchedVertex = OxmModelValidator.validateIncomingPatchPayload(id, version,
                                                                           type, payload.getProperties(),
                                                                           existingVertex);
@@ -318,7 +328,7 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService {
 
   public String updateEdge(String version, String id, String type, EdgePayload payload)
     throws CrudException {
-    Edge edge = dao.getEdge(id, type);
+    Edge edge = dao.getEdge(id, type, new HashMap<String, String>());
     Edge validatedEdge = RelationshipSchemaValidator.validateIncomingUpdatePayload(edge, version,
                                                                                    payload);
     GraphEvent event = GraphEvent.builder(GraphEventOperation.UPDATE)
@@ -340,7 +350,7 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService {
 
   public String patchEdge(String version, String id, String type, EdgePayload payload)
     throws CrudException {
-    Edge edge = dao.getEdge(id, type);
+    Edge edge = dao.getEdge(id, type, new HashMap<String, String>());
     Edge patchedEdge = RelationshipSchemaValidator.validateIncomingPatchPayload(edge, version,
                                                                                 payload);
     GraphEvent event = GraphEvent.builder(GraphEventOperation.UPDATE)
@@ -443,5 +453,4 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService {
         + " , operation: " + event.getOperation().toString() + " , result: "
         + response.getResult() + " , error: " + response.getErrorMessage());
   }
-  
 }
\ No newline at end of file