Make Actors event-agnostic
[policy/models.git] / models-interactions / model-actors / actor.sdnc / src / main / java / org / onap / policy / controlloop / actor / sdnc / SdncOperation.java
index a83faa7..d235fb2 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.policy.controlloop.actor.sdnc;
 
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 import javax.ws.rs.client.Entity;
@@ -44,17 +45,10 @@ public abstract class SdncOperation extends HttpOperation<SdncResponse> {
      *
      * @param params operation parameters
      * @param config configuration for this operation
+     * @param propertyNames names of properties required by this operation
      */
-    public SdncOperation(ControlLoopOperationParams params, HttpConfig config) {
-        super(params, config, SdncResponse.class);
-    }
-
-    /**
-     * Starts the GUARD.
-     */
-    @Override
-    protected CompletableFuture<OperationOutcome> startPreprocessorAsync() {
-        return startGuardAsync();
+    public SdncOperation(ControlLoopOperationParams params, HttpConfig config, List<String> propertyNames) {
+        super(params, config, SdncResponse.class, propertyNames);
     }
 
     @Override
@@ -62,18 +56,20 @@ public abstract class SdncOperation extends HttpOperation<SdncResponse> {
 
         SdncRequest request = makeRequest(attempt);
 
-        Entity<SdncRequest> entity = Entity.entity(request, MediaType.APPLICATION_JSON);
-
         Map<String, Object> headers = makeHeaders();
 
         headers.put("Accept", MediaType.APPLICATION_JSON);
-        String url = makeUrl();
+        String path = getPath();
+        String url = getClient().getBaseUrl() + path;
+
+        String strRequest = prettyPrint(request);
+        logMessage(EventType.OUT, CommInfrastructure.REST, url, strRequest);
 
-        logMessage(EventType.OUT, CommInfrastructure.REST, url, request);
+        Entity<String> entity = Entity.entity(strRequest, MediaType.APPLICATION_JSON);
 
         // @formatter:off
         return handleResponse(outcome, url,
-            callback -> getClient().post(callback, makePath(), entity, headers));
+            callback -> getClient().post(callback, path, entity, headers));
         // @formatter:on
     }