Fixed sonar issues in CustomQueryRequest.java 09/74709/1
authorezhil <ezhrajam@in.ibm.com>
Mon, 17 Dec 2018 11:41:00 +0000 (17:11 +0530)
committerezhil <ezhrajam@in.ibm.com>
Mon, 17 Dec 2018 11:41:12 +0000 (17:11 +0530)
Fixed major and minor sonar issues
Issue-ID: CCSDK-832
Change-Id: I22c84582106e2ddc4068b1d4546618bc44ccec02
Signed-off-by: ezhil <ezhrajam@in.ibm.com>
aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java

index aa402ec..5295907 100644 (file)
@@ -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 {