Clean up of Pair classes - models
[policy/models.git] / models-interactions / model-impl / aai / src / main / java / org / onap / policy / aai / AaiManager.java
index 923b8d3..76817df 100644 (file)
@@ -2,8 +2,8 @@
  * ============LICENSE_START=======================================================
  * aai
  * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
  * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,7 +29,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 import java.util.stream.Collectors;
-
+import org.apache.commons.lang3.tuple.Pair;
 import org.json.JSONArray;
 import org.json.JSONObject;
 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
@@ -38,7 +38,6 @@ import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
 import org.onap.policy.common.utils.coder.CoderException;
 import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.rest.RestManager;
-import org.onap.policy.rest.RestManager.Pair;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -47,6 +46,8 @@ import org.slf4j.LoggerFactory;
  */
 public final class AaiManager {
 
+    // TODO remove this class
+
     /** The Constant logger. */
     private static final Logger logger = LoggerFactory.getLogger(AaiManager.class);
 
@@ -153,17 +154,17 @@ public final class AaiManager {
             return null;
         }
 
-        int httpResponseCode = httpDetails.first;
+        int httpResponseCode = httpDetails.getLeft();
 
         NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, "Response code: " + httpResponseCode);
-        NetLoggerUtil.getNetworkLogger().debug(httpDetails.second);
+        NetLoggerUtil.getNetworkLogger().debug(httpDetails.getRight());
 
         logger.debug(url);
         logger.debug("{}", httpResponseCode);
-        logger.debug(httpDetails.second);
+        logger.debug(httpDetails.getRight());
 
-        if (httpDetails.second != null) {
-            return new AaiCqResponse(httpDetails.second);
+        if (httpDetails.getRight() != null) {
+            return new AaiCqResponse(httpDetails.getRight());
         }
         return null;
     }
@@ -196,17 +197,17 @@ public final class AaiManager {
                 return null;
             }
 
-            int httpResponseCode = httpDetailsGet.first;
+            int httpResponseCode = httpDetailsGet.getLeft();
 
             NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, "Response code: " + httpResponseCode);
-            NetLoggerUtil.getNetworkLogger().debug(httpDetailsGet.second);
+            NetLoggerUtil.getNetworkLogger().debug(httpDetailsGet.getRight());
 
             logger.debug(urlGet);
             logger.debug("{}", httpResponseCode);
-            logger.debug(httpDetailsGet.second);
+            logger.debug(httpDetailsGet.getRight());
 
-            if (httpResponseCode == 200 && httpDetailsGet.second != null) {
-                return httpDetailsGet.second;
+            if (httpResponseCode == 200 && httpDetailsGet.getRight() != null) {
+                return httpDetailsGet.getRight();
             }
             try {
                 Thread.sleep(1000);
@@ -251,7 +252,7 @@ public final class AaiManager {
             urlGet = url + PNF_URL;
             pnfName = URLEncoder.encode(pnfName, StandardCharsets.UTF_8.toString()) + AAI_DEPTH_SUFFIX;
         } catch (UnsupportedEncodingException e) {
-            logger.error("Failed to encode the pnfName: {} using UTF-8 encoding. {}", pnfName, e);
+            logger.error("Failed to encode the pnfName: {} using UTF-8", pnfName, e);
             return null;
         }
         String responseGet = getStringQuery(urlGet, username, password, requestId, pnfName);