summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/aai/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-06-13 10:39:55 -0400
committerJim Hahn <jrh3@att.com>2019-06-17 10:50:16 -0400
commitd37c71292d9cbdd892f328d63f49a8027b1f13c4 (patch)
tree615a8af45285d1032a02af1214c76b938c58044d /models-interactions/model-impl/aai/src/main
parentf59ec395bf1e41df894f884e70ff3185280668c0 (diff)
Fix simple sonar issues in models
Added @FunctionalInterface where needed. Replaced anonymous classes with lambda expressions. Replaced duplicate strings with a constant. Removed unused BeforeClass & AfterClass test methods. Removed some trailing spaces. Fixed: aai actor.appc actor.appclcm actor.sdnc actor.sdnr actor.so actor.vfc actorServiceProvider appc appclcm cds events Change-Id: I0e21cbb10db6d1217bbd0e00e6dd4fac3eb84e31 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-impl/aai/src/main')
-rw-r--r--models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
index 2b51a7bde..20998ae0c 100644
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
+++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
@@ -45,6 +45,8 @@ public final class AaiManager {
/** The Constant logger. */
private static final Logger logger = LoggerFactory.getLogger(AaiManager.class);
+ private static final String APPLICATION_JSON = "application/json";
+
/** The rest manager. */
// The REST manager used for processing REST calls for this AAI manager
private final RestManager restManager;
@@ -77,7 +79,7 @@ public final class AaiManager {
return null;
} else {
JSONObject responseObj = new JSONObject(getResponse);
- JSONArray resultsArray = new JSONArray();
+ JSONArray resultsArray;
if (responseObj.has("result-data")) {
resultsArray = (JSONArray) responseObj.get("result-data");
} else {
@@ -138,7 +140,7 @@ public final class AaiManager {
url = url + CQ_URL;
Pair<Integer, String> httpDetails =
- this.restManager.put(url, username, password, headers, "application/json", requestJson);
+ this.restManager.put(url, username, password, headers, APPLICATION_JSON, requestJson);
logger.debug("RestManager.put after");
if (httpDetails == null) {
@@ -232,7 +234,7 @@ public final class AaiManager {
String requestJson = Serialization.gsonPretty.toJson(request);
NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, requestJson);
Pair<Integer, String> httpDetails =
- restManager.post(url, username, password, headers, "application/json", requestJson);
+ restManager.post(url, username, password, headers, APPLICATION_JSON, requestJson);
logger.debug("RestManager.post after");
if (httpDetails == null) {
@@ -360,7 +362,7 @@ public final class AaiManager {
headers.put("X-FromAppId", "POLICY");
headers.put("X-TransactionId", requestId.toString());
- headers.put("Accept", "application/json");
+ headers.put("Accept", APPLICATION_JSON);
return headers;
}