summaryrefslogtreecommitdiffstats
path: root/aai-service/provider/src
diff options
context:
space:
mode:
Diffstat (limited to 'aai-service/provider/src')
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java10
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java3
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java6
-rw-r--r--aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java8
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java12
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java26
6 files changed, 26 insertions, 39 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
index cf1392f67..a3aecda14 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
@@ -44,7 +44,6 @@ import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Properties;
-import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
@@ -82,6 +81,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
private String userPassword;
private final String applicationId;
private static final String HTTP_URL_CONNECTION_RESULT="HttpURLConnection result: {} : {}";
+ private static final String ENTRY_DOESNT_EXIST="Entry does not exist.";
/**
* class Constructor
@@ -281,7 +281,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(response));
}
} else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) {
- LOGwriteEndingTrace(responseCode, responseMessage, "Entry does not exist.");
+ LOGwriteEndingTrace(responseCode, responseMessage, ENTRY_DOESNT_EXIST);
ErrorResponse errorresponse = null;
try {
errorresponse = mapper.readValue(reader, ErrorResponse.class);
@@ -289,7 +289,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
errorresponse = new ErrorResponse();
RequestError requestError = new RequestError();
ServiceException serviceException = new ServiceException();
- serviceException.setText("Entry does not exist.");
+ serviceException.setText(ENTRY_DOESNT_EXIST);
requestError.setServiceException(serviceException);
errorresponse.setRequestError(requestError );
}
@@ -501,7 +501,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString());
response = true;
} else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
- LOGwriteEndingTrace(responseCode, responseMessage, "Entry does not exist.");
+ LOGwriteEndingTrace(responseCode, responseMessage, ENTRY_DOESNT_EXIST);
response = false;
} else {
ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
@@ -574,7 +574,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
response = mapper.readValue(reader, clas);
LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response));
} else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) {
- LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
+ LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", ENTRY_DOESNT_EXIST);
return response;
} else {
BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) );
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
index 82df69818..c66ae06f4 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
@@ -433,8 +433,7 @@ public abstract class AAIRequest {
if(clazz == null) {
return null;
}
- GenericRequest request = new GenericRequest(clazz);
- return request;
+ return new GenericRequest(clazz);
}
public static Map<String, String> splitQuery(String query) throws UnsupportedEncodingException {
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
index 6af9f9cd6..6c48c63dd 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
@@ -5,6 +5,8 @@
* 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.
* You may obtain a copy of the License at
@@ -153,7 +155,7 @@ public class AAIServiceUtils {
String term1 = null;
String op = null;
String term2 = null;
- HashMap<String, String> results = new HashMap<String, String>();
+ HashMap<String, String> results = new HashMap<>();
for (int i = 0; i < keyTerms.length; i++) {
if (term1 == null) {
@@ -267,7 +269,7 @@ public class AAIServiceUtils {
}
protected static HashMap<String,String> pathToHashMap(String path) {
- HashMap<String, String> nameValues = new HashMap<String, String>();
+ HashMap<String, String> nameValues = new HashMap<>();
String[] split = path.split("/");
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java
index 515359602..35f190e52 100644
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java
@@ -5,6 +5,8 @@
* 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.
* You may obtain a copy of the License at
@@ -104,19 +106,19 @@ public class GenericQueryRequest extends AAIRequest {
String encoded_vnf = encodeQuery(requestProperties.getProperty(key));
request_url = request_url.replace("{identifier}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("identifier", requestProperties.getProperty(key));
+ aaiService.LOGwriteDateTrace(IDENTIFIER, requestProperties.getProperty(key));
key = VALUE;
encoded_vnf = encodeQuery(requestProperties.getProperty(key));
request_url = request_url.replace("{value}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("value", requestProperties.getProperty(key));
+ aaiService.LOGwriteDateTrace(VALUE, requestProperties.getProperty(key));
key = START_NODE_TYPE;
encoded_vnf = encodeQuery(requestProperties.getProperty(key));
request_url = request_url.replace("{start-node-type}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("start-node-type", requestProperties.getProperty(key));
+ aaiService.LOGwriteDateTrace(START_NODE_TYPE, requestProperties.getProperty(key));
return request_url;
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java
index 691ae27a3..d1995f04f 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java
@@ -5,6 +5,8 @@
* 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.
* You may obtain a copy of the License at
@@ -107,7 +109,7 @@ public class NamedQueryRequest extends AAIRequest {
if(innerChild != null) {
if(innerChild instanceof ObjectNode) {
ObjectNode on = ObjectNode.class.cast(innerChild);
- List<String> namesToDelete = new ArrayList<String>();
+ List<String> namesToDelete = new ArrayList<>();
Iterator<String> names = on.fieldNames();
while(names.hasNext()) {
String name = names.next();
@@ -125,7 +127,7 @@ public class NamedQueryRequest extends AAIRequest {
if(innerChild != null) {
if(innerChild instanceof ObjectNode) {
ObjectNode on = ObjectNode.class.cast(innerChild);
- List<String> namesToDelete = new ArrayList<String>();
+ List<String> namesToDelete = new ArrayList<>();
Iterator<String> names = on.fieldNames();
while(names.hasNext()) {
String name = names.next();
@@ -143,7 +145,7 @@ public class NamedQueryRequest extends AAIRequest {
if(innerChild != null) {
if(innerChild instanceof ObjectNode) {
ObjectNode on = ObjectNode.class.cast(innerChild);
- List<String> namesToDelete = new ArrayList<String>();
+ List<String> namesToDelete = new ArrayList<>();
Iterator<String> names = on.fieldNames();
while(names.hasNext()) {
String name = names.next();
@@ -194,7 +196,7 @@ public class NamedQueryRequest extends AAIRequest {
if(requestProperties.containsKey(key)) {
encoded_vnf = encodeQuery(requestProperties.getProperty(key));
request_url = request_url.replace("{named-query-uuid}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("named-query-uuid", requestProperties.getProperty(key));
+ aaiService.LOGwriteDateTrace(NAMED_QUERY_UUID, requestProperties.getProperty(key));
}
key = PREFIX;
@@ -202,7 +204,7 @@ public class NamedQueryRequest extends AAIRequest {
if(requestProperties.containsKey(key)) {
encoded_vnf = encodeQuery(requestProperties.getProperty(key));
request_url = request_url.replace("{prefix}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("prefix", requestProperties.getProperty(key));
+ aaiService.LOGwriteDateTrace(PREFIX, requestProperties.getProperty(key));
}
return request_url;
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java
index 0099e933d..dafc4a70c 100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java
@@ -5,6 +5,8 @@
* 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.
* You may obtain a copy of the License at
@@ -48,26 +50,6 @@ public class NodesQueryRequest extends AAIRequest {
}
-// @Override
-// public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
-//
-// String request_url = targetUri+generic_search_path;
-// String key = START_NODE_TYPE;
-//
-// String encoded_vnf = encodeQuery(requestProperties.getProperty(key));
-// request_url = request_url.replace("{vnf-id}", encoded_vnf) ;
-//
-// if(resourceVersion != null) {
-// request_url = request_url +"?resource-version="+resourceVersion;
-// }
-// URL http_req_url = new URL(request_url);
-//
-// aaiService.LOGwriteFirstTrace(method, http_req_url.toString());
-//
-//
-// return http_req_url;
-// }
-
@Override
public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
@@ -125,7 +107,7 @@ public class NodesQueryRequest extends AAIRequest {
String encoded_vnf = encodeQuery(requestProperties.getProperty(key));
request_url = request_url.replace("{entity-identifier}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("entity-identifier", requestProperties.getProperty(key));
+ aaiService.LOGwriteDateTrace(ENTITY_IDENTIFIER, requestProperties.getProperty(key));
key = ENTITY_VALUE;
@@ -137,7 +119,7 @@ public class NodesQueryRequest extends AAIRequest {
encoded_vnf = encodeQuery(requestProperties.getProperty(key));
request_url = request_url.replace("{node-type}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("node-type", requestProperties.getProperty(key));
+ aaiService.LOGwriteDateTrace(NODE_TYPE, requestProperties.getProperty(key));
return request_url;
}