Java 17 Upgrade
[policy/models.git] / models-interactions / model-actors / actor.aai / src / main / java / org / onap / policy / controlloop / actor / aai / AaiGetPnfOperation.java
index d89d835..519b142 100644 (file)
@@ -2,7 +2,8 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package org.onap.policy.controlloop.actor.aai;
 
+import jakarta.ws.rs.client.Invocation.Builder;
+import jakarta.ws.rs.client.WebTarget;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
-import javax.ws.rs.client.Invocation.Builder;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
 import org.onap.policy.aai.AaiConstants;
 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
 import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
 import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
 import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
 import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
 
@@ -70,11 +71,10 @@ public class AaiGetPnfOperation extends AaiGetOperation {
     protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
         Map<String, Object> headers = makeHeaders();
 
-        headers.put("Accept", MediaType.APPLICATION_JSON);
+        var str = new StringBuilder(getClient().getBaseUrl());
 
-        StringBuilder str = new StringBuilder(getClient().getBaseUrl());
-
-        String path = getPath() + URI_SEP + URLEncoder.encode(getTargetEntity(), StandardCharsets.UTF_8);
+        String target = getRequiredProperty(OperationProperties.AAI_TARGET_ENTITY, "target entity");
+        String path = getPath() + URI_SEP + URLEncoder.encode(target, StandardCharsets.UTF_8);
         WebTarget web = getClient().getWebTarget().path(path);
         str.append(path);
 
@@ -83,7 +83,7 @@ public class AaiGetPnfOperation extends AaiGetOperation {
         Builder webldr = web.request();
         addHeaders(webldr, headers);
 
-        String url = str.toString();
+        var url = str.toString();
 
         logMessage(EventType.OUT, CommInfrastructure.REST, url, null);