diff options
author | 2018-12-17 20:52:45 +0000 | |
---|---|---|
committer | 2018-12-17 20:52:45 +0000 | |
commit | ce68f67d008c292f36d440f2dc473ba23d673fce (patch) | |
tree | a55b0817cf9a1e8a7a2a1241e701f476d53a68fa /aai-service/provider/src/main/java/org | |
parent | 15e630e96b11d57ed8ac0e1493a0276b45e34215 (diff) | |
parent | 8c11b896026cfd138fcc6dc59a24e23817ea14f6 (diff) |
Merge "Fixed sonar issues in CustomQueryRequest.java"
Diffstat (limited to 'aai-service/provider/src/main/java/org')
-rw-r--r-- | aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java index aa402ecf..52959073 100644 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. + * Modifications Copyright (C) 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +40,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class CustomQueryRequest extends AAIRequest { - public static final String GENERIC_SEARCH_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.generic"; + public static final String GENERIC_SEARCH_PATH_CONST = "org.onap.ccsdk.sli.adaptors.aai.query.generic"; private final String generic_search_path; @@ -47,29 +48,29 @@ public class CustomQueryRequest extends AAIRequest { public CustomQueryRequest() { - String tmp_generic_search_path = configProperties.getProperty(GENERIC_SEARCH_PATH); - tmp_generic_search_path = tmp_generic_search_path.split("search")[0]; - generic_search_path = tmp_generic_search_path +"query"; + String tmpGenericSearchPath = configProperties.getProperty(GENERIC_SEARCH_PATH_CONST); + tmpGenericSearchPath = tmpGenericSearchPath.split("search")[0]; + generic_search_path = tmpGenericSearchPath +"query"; } @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - String request_url = targetUri+generic_search_path; + String requestUrl = targetUri+generic_search_path; - request_url = processPathData(request_url, requestProperties); + requestUrl = processPathData(requestUrl, requestProperties); String formatQuery = requestProperties.getProperty(FORMAT); if(formatQuery != null) { - request_url = request_url +"?format="+formatQuery; + requestUrl = requestUrl +"?format="+formatQuery; } - URL http_req_url = new URL(request_url); + URL httpReqUrl = new URL(requestUrl); - aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); + aaiService.LOGwriteFirstTrace(method, httpReqUrl.toString()); - return http_req_url; + return httpReqUrl; } @Override @@ -82,14 +83,14 @@ public class CustomQueryRequest extends AAIRequest { public String toJSONString() { ObjectMapper mapper = getObjectMapper(); FormattedQueryRequestData tenant = (FormattedQueryRequestData)requestDatum; - String json_text = null; + String jsonText = null; try { - json_text = mapper.writeValueAsString(tenant); + jsonText = mapper.writeValueAsString(tenant); } catch (JsonProcessingException exc) { handleException(this, exc); return null; } - return json_text; + return jsonText; } @@ -106,15 +107,15 @@ public class CustomQueryRequest extends AAIRequest { } - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + public static String processPathData(String requestUrl, Properties requestProperties) throws UnsupportedEncodingException { String key = FORMAT; String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{identifier}", encoded_vnf) ; + requestUrl = requestUrl.replace("{identifier}", encoded_vnf) ; aaiService.LOGwriteDateTrace("identifier", requestProperties.getProperty(key)); - return request_url; + return requestUrl; } public AAIDatum jsonStringToObject(String jsonData) throws JsonParseException, JsonMappingException, IOException { |