diff options
author | Liam Fallon <liam.fallon@ericsson.com> | 2017-12-06 23:06:31 +0100 |
---|---|---|
committer | Liam Fallon <liam.fallon@ericsson.com> | 2017-12-06 23:09:55 +0100 |
commit | c3619a82215b2277087f73741d57d3a3b75325f6 (patch) | |
tree | bc2dc805151e48935b85d478f8d7e8effbfb433f /controlloop/common/model-impl/aai/src/main/java | |
parent | bd7ee8043627c74f6ea2145dde279313da58261d (diff) |
Technical Debt in AAI.
Eliminate the technical debt identified in the drools-applications/controlloop/common/model-impl/aai module by Sonar
Change-Id: I72125baacc217386a4984be04bfc023439eddd13
Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
Issue-ID: POLICY-455
Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
Diffstat (limited to 'controlloop/common/model-impl/aai/src/main/java')
28 files changed, 248 insertions, 220 deletions
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java index caba0596f..ac6e38deb 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETResponse.java @@ -48,8 +48,4 @@ public class AAIGETResponse implements Serializable { @SerializedName("requestError") public AAINQRequestError requestError; - - public AAIGETResponse() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java index a95502cca..c89083b18 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVnfResponse.java @@ -45,8 +45,4 @@ public class AAIGETVnfResponse extends AAIGETResponse implements Serializable { @SerializedName("orchestration-status") public String orchestrationStatus; - - public AAIGETVnfResponse() { - } - }
\ No newline at end of file diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java index 527bbe528..162df0d93 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIGETVserverResponse.java @@ -42,8 +42,4 @@ public class AAIGETVserverResponse extends AAIGETResponse implements Serializabl @SerializedName("vserver-selflink") public String vserverSelflink; - - public AAIGETVserverResponse() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java index c92ea775b..621398282 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java @@ -33,117 +33,109 @@ import org.slf4j.LoggerFactory; import com.google.gson.JsonSyntaxException; public final class AAIManager { + private static final String LINE_SEPARATOR = System.lineSeparator(); + + /** + * Private constructor added to avoid instantiation of static class + */ + private AAIManager() { + } + private static final Logger logger = LoggerFactory.getLogger(AAIManager.class); private static final Logger netLogger = LoggerFactory.getLogger(org.onap.policy.drools.event.comm.Topic.NETWORK_LOGGER); - + public static AAINQResponse postQuery(String url, String username, String password, AAINQRequest request, UUID requestID) { - - Map<String, String> headers = new HashMap<>(); - headers.put("X-FromAppId", "POLICY"); - headers.put("X-TransactionId", requestID.toString()); - headers.put("Accept", "application/json"); - + + Map<String, String> headers = createHeaders(requestID); + url = url + "/aai/search/named-query"; logger.debug("RESTManager.post before"); String requestJson = Serialization.gsonPretty.toJson(request); - netLogger.info("[OUT|{}|{}|]{}{}", "AAI", url, System.lineSeparator(), requestJson); + netLogger.info("[OUT|{}|{}|]{}{}", "AAI", url, LINE_SEPARATOR, requestJson); Pair<Integer, String> httpDetails = RESTManager.post(url, username, password, headers, "application/json", requestJson); logger.debug("RESTManager.post after"); - + if (httpDetails == null) { - logger.info("AAI POST Null Response to " + url); + logger.info("AAI POST Null Response to {}", url); return null; } + + int httpResponseCode = httpDetails.a; logger.info(url); - logger.info(httpDetails.a.toString()); + logger.info("{}", httpResponseCode); logger.info(httpDetails.b); + if (httpDetails.b != null) { - try { - AAINQResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, AAINQResponse.class); - netLogger.info("[IN|{}|{}|]{}{}", "AAI", url, System.lineSeparator(), httpDetails.b); - return response; - } catch (JsonSyntaxException e) { - logger.error("postQuery threw: ", e); - } + return composeResponse(httpDetails, url, AAINQResponse.class); } return null; } - + public static AAIGETVserverResponse getQueryByVserverName(String urlGet, String username, String password, UUID requestID, String key) { - - Map<String, String> headers = new HashMap<>(); - headers.put("X-FromAppId", "POLICY"); - headers.put("X-TransactionId", requestID.toString()); - headers.put("Accept", "application/json"); - + + Map<String, String> headers = createHeaders(requestID); + urlGet = urlGet + key; - + int attemptsLeft = 3; - AAIGETVserverResponse responseGet = null; - + while(attemptsLeft-- > 0){ netLogger.info("[OUT|{}|{}|]", "AAI", urlGet); Pair<Integer, String> httpDetailsGet = RESTManager.get(urlGet, username, password, headers); if (httpDetailsGet == null) { - logger.info("AAI GET Null Response to " + urlGet); + logger.info("AAI GET Null Response to {}", urlGet); return null; } + + int httpResponseCode = httpDetailsGet.a; logger.info(urlGet); - logger.info(httpDetailsGet.a.toString()); + logger.info("{}", httpResponseCode); logger.info(httpDetailsGet.b); - - if (httpDetailsGet.a == 200) { - try { - responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, AAIGETVserverResponse.class); - netLogger.info("[IN|{}|{}|]{}{}", "AAI", urlGet, System.lineSeparator(), httpDetailsGet.b); + + if (httpResponseCode == 200) { + AAIGETVserverResponse responseGet = composeResponse(httpDetailsGet, urlGet, AAIGETVserverResponse.class); + if (responseGet != null) { return responseGet; - } catch (JsonSyntaxException e) { - logger.error("postQuery threw: ", e); } } try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } - } - + } + return null; } - + public static AAIGETVnfResponse getQueryByVnfID(String urlGet, String username, String password, UUID requestID, String key) { - - Map<String, String> headers = new HashMap<>(); - headers.put("X-FromAppId", "POLICY"); - headers.put("X-TransactionId", requestID.toString()); - headers.put("Accept", "application/json"); - + + Map<String, String> headers = createHeaders(requestID); + urlGet = urlGet + key; - + int attemptsLeft = 3; - AAIGETVnfResponse responseGet = null; - + while(attemptsLeft-- > 0){ netLogger.info("[OUT|{}|{}|]", "AAI", urlGet); Pair<Integer, String> httpDetailsGet = RESTManager.get(urlGet, username, password, headers); if (httpDetailsGet == null) { - logger.info("AAI GET Null Response to " + urlGet); + logger.info("AAI GET Null Response to {}", urlGet); return null; } + + int httpResponseCode = httpDetailsGet.a; logger.info(urlGet); - logger.info(httpDetailsGet.a.toString()); + logger.info("{}", httpResponseCode); logger.info(httpDetailsGet.b); - - if (httpDetailsGet.a == 200) { - try { - responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, AAIGETVnfResponse.class); - netLogger.info("[IN|{}|{}|]{}{}", "AAI", urlGet, System.lineSeparator(), httpDetailsGet.b); + + if (httpResponseCode == 200) { + AAIGETVnfResponse responseGet = composeResponse(httpDetailsGet, urlGet, AAIGETVnfResponse.class); + if (responseGet != null) { return responseGet; - } catch (JsonSyntaxException e) { - logger.error("postQuery threw: ", e); } } try { @@ -151,49 +143,45 @@ public final class AAIManager { } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } - + return null; } - + public static AAIGETVnfResponse getQueryByVnfName(String urlGet, String username, String password, UUID requestID, String key) { - + return getQueryByVnfID(urlGet, username, password, requestID, key); + } + + /** + * Create the headers for the HTTP request + * @param requestID the request ID to insert in the headers + * @return the HTTP headers + */ + private static Map<String, String> createHeaders(final UUID requestID) { Map<String, String> headers = new HashMap<>(); + headers.put("X-FromAppId", "POLICY"); headers.put("X-TransactionId", requestID.toString()); headers.put("Accept", "application/json"); - - urlGet = urlGet + key; - - int attemptsLeft = 3; - AAIGETVnfResponse responseGet = null; - - while(attemptsLeft-- > 0){ - netLogger.info("[OUT|{}|{}|]", "AAI", urlGet); - Pair<Integer, String> httpDetailsGet = RESTManager.get(urlGet, username, password, headers); - if (httpDetailsGet == null) { - logger.info("AAI GET Null Response to " + urlGet); - return null; - } - - logger.info(urlGet); - logger.info(httpDetailsGet.a.toString()); - logger.info(httpDetailsGet.b); - - if (httpDetailsGet.a == 200) { - try { - responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, AAIGETVnfResponse.class); - netLogger.info("[IN|{}|{}|]{}{}", "AAI", urlGet, System.lineSeparator(), httpDetailsGet.b); - return responseGet; - } catch (JsonSyntaxException e) { - logger.error("postQuery threw: ", e); - } - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { Thread.currentThread().interrupt(); } + return headers; + } + + /** + * This method uses Google's GSON to create a response object from a JSON string + * @param httpDetails the HTTP response + * @param url the URL from which the response came + * @param classOfT The response class + * @return an instance of the response class + * @throws JsonSyntaxException on GSON errors instantiating the response + */ + private static <T> T composeResponse(final Pair<Integer, String> httpDetails, final String url, final Class<T> classOfT) { + try { + T response = Serialization.gsonPretty.fromJson(httpDetails.b, classOfT); + netLogger.info("[IN|{}|{}|]{}{}", "AAI", url, LINE_SEPARATOR, httpDetails.b); + return response; + } catch (JsonSyntaxException e) { + logger.error("postQuery threw: ", e); + return null; } - - return null; } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java index cbe2b9730..bfeb1e56c 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQCloudRegion.java @@ -45,7 +45,4 @@ public class AAINQCloudRegion implements Serializable { @SerializedName("resource-version") public String resourceVersion; - - public AAINQCloudRegion() { - } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java index 6f451ce8d..b11859aeb 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQExtraProperties.java @@ -34,9 +34,13 @@ public class AAINQExtraProperties implements Serializable { private static final long serialVersionUID = 4109625574744702319L; @SerializedName("extra-property") - public List<AAINQExtraProperty> extraProperty = new LinkedList<AAINQExtraProperty>(); - - public AAINQExtraProperties() { + private List<AAINQExtraProperty> extraProperty = new LinkedList<>(); + + public List<AAINQExtraProperty> getExtraProperty() { + return extraProperty; + } + + public void setExtraProperty(List<AAINQExtraProperty> extraProperty) { + this.extraProperty = extraProperty; } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java index d2bff6b7b..12b8fc42a 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQGenericVNF.java @@ -81,8 +81,4 @@ public class AAINQGenericVNF implements Serializable { @SerializedName("model-version-id") public String modelVersionId; - - public AAINQGenericVNF() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInstanceFilters.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInstanceFilters.java index b122279d6..24b833f25 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInstanceFilters.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInstanceFilters.java @@ -35,9 +35,13 @@ public class AAINQInstanceFilters implements Serializable { private static final long serialVersionUID = 8993824591338121185L; @SerializedName("instance-filter") - public List<Map<String, Map<String, String>>> instanceFilter = new LinkedList<>(); - - public AAINQInstanceFilters() { + private List<Map<String, Map<String, String>>> instanceFilter = new LinkedList<>(); + + public List<Map<String, Map<String, String>>> getInstanceFilter() { + return instanceFilter; } + public void setInstanceFilter(List<Map<String, Map<String, String>>> instanceFilter) { + this.instanceFilter = instanceFilter; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java index 1dece7da0..b4f1767e4 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItem.java @@ -57,8 +57,4 @@ public class AAINQInventoryResponseItem implements Serializable { @SerializedName("inventory-response-items") public AAINQInventoryResponseItems items; - - public AAINQInventoryResponseItem() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java index f4ee0fa3e..8e9728ab3 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQInventoryResponseItems.java @@ -34,9 +34,13 @@ public class AAINQInventoryResponseItems implements Serializable { private static final long serialVersionUID = 7602807659381179004L; @SerializedName("inventory-response-item") - public List<AAINQInventoryResponseItem> inventoryResponseItems = new LinkedList<>(); - - public AAINQInventoryResponseItems() { + private List<AAINQInventoryResponseItem> inventoryResponseItems = new LinkedList<>(); + + public List<AAINQInventoryResponseItem> getInventoryResponseItems() { + return inventoryResponseItems; } + public void setInventoryResponseItems(List<AAINQInventoryResponseItem> inventoryResponseItems) { + this.inventoryResponseItems = inventoryResponseItems; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java index 7ed82e1e9..423c98090 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQNamedQuery.java @@ -34,8 +34,4 @@ public class AAINQNamedQuery implements Serializable { @SerializedName("named-query-uuid") public UUID namedQueryUUID; - - public AAINQNamedQuery() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java index eca372bf6..ddff71043 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQQueryParameters.java @@ -33,8 +33,4 @@ public class AAINQQueryParameters implements Serializable { @SerializedName("named-query") public AAINQNamedQuery namedQuery; - - public AAINQQueryParameters() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java index 91d9f1a6e..d8d600075 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequest.java @@ -35,8 +35,4 @@ public class AAINQRequest implements Serializable { public AAINQQueryParameters queryParameters; @SerializedName("instance-filters") public AAINQInstanceFilters instanceFilters; - - public AAINQRequest() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java index 527a12089..2e6776fc6 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java @@ -35,12 +35,24 @@ public class AAINQResponse implements Serializable { private static final long serialVersionUID = 8411407444051746101L; @SerializedName("inventory-response-item") - public List<AAINQInventoryResponseItem> inventoryResponseItems = new LinkedList<>(); + private List<AAINQInventoryResponseItem> inventoryResponseItems = new LinkedList<>(); @SerializedName("requestError") - public AAINQRequestError requestError; + private AAINQRequestError requestError; - public AAINQResponse() { + public List<AAINQInventoryResponseItem> getInventoryResponseItems() { + return inventoryResponseItems; } + public void setInventoryResponseItems(List<AAINQInventoryResponseItem> inventoryResponseItems) { + this.inventoryResponseItems = inventoryResponseItems; + } + + public AAINQRequestError getRequestError() { + return requestError; + } + + public void setRequestError(AAINQRequestError requestError) { + this.requestError = requestError; + } }
\ No newline at end of file diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponseWrapper.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponseWrapper.java index 7bb58eb7d..e8d1620de 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponseWrapper.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponseWrapper.java @@ -26,15 +26,30 @@ import org.onap.policy.aai.AAINQResponse; public class AAINQResponseWrapper { - public UUID requestID; - public AAINQResponse aainqresponse; + private UUID requestID; + private AAINQResponse aainqresponse; public AAINQResponseWrapper() { - } public AAINQResponseWrapper(UUID requestID, AAINQResponse aainqresponse){ this.requestID = requestID; this.aainqresponse = aainqresponse; } + + public UUID getRequestID() { + return requestID; + } + + public void setRequestID(UUID requestID) { + this.requestID = requestID; + } + + public AAINQResponse getAainqresponse() { + return aainqresponse; + } + + public void setAainqresponse(AAINQResponse aainqresponse) { + this.aainqresponse = aainqresponse; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java index ed7d9225a..256a057a4 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceInstance.java @@ -54,8 +54,4 @@ public class AAINQServiceInstance implements Serializable { @SerializedName("model-version-id") public String modelVersionId; - - public AAINQServiceInstance() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java index 98ea83b1f..afd55fd45 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQTenant.java @@ -39,7 +39,4 @@ public class AAINQTenant implements Serializable { @SerializedName("resource-version") public String resourceVersion; - - public AAINQTenant() { - } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java index 5a9834fee..f6130e95b 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVServer.java @@ -54,8 +54,4 @@ public class AAINQVServer implements Serializable { @SerializedName("resource-version") public String resourceVersion; - - public AAINQVServer() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java index 07c4303c2..b20681d7f 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQVfModule.java @@ -69,7 +69,4 @@ public class AAINQVfModule implements Serializable { @SerializedName("model-version-id") public String modelVersionId; - - public AAINQVfModule() { - } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java index d8074e0a8..56fb77362 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNF.java @@ -29,28 +29,44 @@ public class PNF implements Serializable { */ private static final long serialVersionUID = -3535108358668248501L; - public String PNFName; - public PNFType PNFType; + private String pnfName; + private PNFType pnfType; public PNF() { } public PNF(PNF pnf) { - this.PNFName = pnf.PNFName; - this.PNFType = pnf.PNFType; + this.pnfName = pnf.pnfName; + this.pnfType = pnf.pnfType; } + public String getPNFName() { + return pnfName; + } + + public void setPNFName(String pNFName) { + pnfName = pNFName; + } + + public PNFType getPNFType() { + return pnfType; + } + + public void setPNFType(PNFType pNFType) { + pnfType = pNFType; + } + @Override public String toString() { - return "PNF [PNFName=" + PNFName + ", PNFType=" + PNFType + "]"; + return "PNF [PNFName=" + pnfName + ", PNFType=" + pnfType + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((PNFName == null) ? 0 : PNFName.hashCode()); - result = prime * result + ((PNFType == null) ? 0 : PNFType.hashCode()); + result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode()); + result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode()); return result; } @Override @@ -62,14 +78,11 @@ public class PNF implements Serializable { if (getClass() != obj.getClass()) return false; PNF other = (PNF) obj; - if (PNFName == null) { - if (other.PNFName != null) + if (pnfName == null) { + if (other.pnfName != null) return false; - } else if (!PNFName.equals(other.PNFName)) + } else if (!pnfName.equals(other.pnfName)) return false; - if (PNFType != other.PNFType) - return false; - return true; + return pnfType == other.pnfType; } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFInstance.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFInstance.java index 21d1d50ac..159e5cb28 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFInstance.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/PNFInstance.java @@ -29,10 +29,10 @@ public class PNFInstance implements Serializable { */ private static final long serialVersionUID = -3694152433472165034L; - public String PNFName; - public String PNFInstanceName; - public PNFType PNFType; - public String PNFSerial; + private String pnfName; + private String pnfInstanceName; + private PNFType pnfType; + private String pnfSerial; public PNFInstance() { @@ -42,26 +42,58 @@ public class PNFInstance implements Serializable { if (instance == null) { return; } - this.PNFName = instance.PNFName; - this.PNFInstanceName = instance.PNFInstanceName; - this.PNFType = instance.PNFType; - this.PNFSerial = instance.PNFSerial; + this.pnfName = instance.pnfName; + this.pnfInstanceName = instance.pnfInstanceName; + this.pnfType = instance.pnfType; + this.pnfSerial = instance.pnfSerial; + } + + public String getPNFName() { + return pnfName; + } + + public void setPNFName(String pNFName) { + pnfName = pNFName; + } + + public String getPNFInstanceName() { + return pnfInstanceName; + } + + public void setPNFInstanceName(String pNFInstanceName) { + pnfInstanceName = pNFInstanceName; + } + + public PNFType getPNFType() { + return pnfType; + } + + public void setPNFType(PNFType pNFType) { + pnfType = pNFType; + } + + public String getPNFSerial() { + return pnfSerial; + } + + public void setPNFSerial(String pNFSerial) { + pnfSerial = pNFSerial; } @Override public String toString() { - return "PNFInstance [PNFName=" + PNFName + ", PNFInstanceName=" + PNFInstanceName + ", PNFType=" + PNFType - + ", PNFSerial=" + PNFSerial + "]"; + return "PNFInstance [PNFName=" + pnfName + ", PNFInstanceName=" + pnfInstanceName + ", PNFType=" + pnfType + + ", PNFSerial=" + pnfSerial + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((PNFInstanceName == null) ? 0 : PNFInstanceName.hashCode()); - result = prime * result + ((PNFName == null) ? 0 : PNFName.hashCode()); - result = prime * result + ((PNFSerial == null) ? 0 : PNFSerial.hashCode()); - result = prime * result + ((PNFType == null) ? 0 : PNFType.hashCode()); + result = prime * result + ((pnfInstanceName == null) ? 0 : pnfInstanceName.hashCode()); + result = prime * result + ((pnfName == null) ? 0 : pnfName.hashCode()); + result = prime * result + ((pnfSerial == null) ? 0 : pnfSerial.hashCode()); + result = prime * result + ((pnfType == null) ? 0 : pnfType.hashCode()); return result; } @@ -74,24 +106,21 @@ public class PNFInstance implements Serializable { if (getClass() != obj.getClass()) return false; PNFInstance other = (PNFInstance) obj; - if (PNFInstanceName == null) { - if (other.PNFInstanceName != null) + if (pnfInstanceName == null) { + if (other.pnfInstanceName != null) return false; - } else if (!PNFInstanceName.equals(other.PNFInstanceName)) + } else if (!pnfInstanceName.equals(other.pnfInstanceName)) return false; - if (PNFName == null) { - if (other.PNFName != null) + if (pnfName == null) { + if (other.pnfName != null) return false; - } else if (!PNFName.equals(other.PNFName)) + } else if (!pnfName.equals(other.pnfName)) return false; - if (PNFSerial == null) { - if (other.PNFSerial != null) + if (pnfSerial == null) { + if (other.pnfSerial != null) return false; - } else if (!PNFSerial.equals(other.PNFSerial)) + } else if (!pnfSerial.equals(other.pnfSerial)) return false; - if (PNFType != other.PNFType) - return false; - return true; + return pnfType == other.pnfType; } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java index 2f8acf697..bb3a95f30 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToProperty.java @@ -33,9 +33,13 @@ public class RelatedToProperty implements Serializable { */ private static final long serialVersionUID = 2088088164920423658L; @SerializedName("related-to-property") - public List<RelatedToPropertyItem> relatedTo = new LinkedList<RelatedToPropertyItem>(); + private List<RelatedToPropertyItem> relatedTo = new LinkedList<>(); - public RelatedToProperty() { + public List<RelatedToPropertyItem> getRelatedTo() { + return relatedTo; + } + public void setRelatedTo(List<RelatedToPropertyItem> relatedTo) { + this.relatedTo = relatedTo; } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java index d455bcf48..24466d6dc 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelatedToPropertyItem.java @@ -35,8 +35,4 @@ public class RelatedToPropertyItem implements Serializable { public String propertyKey; @SerializedName("property-value") public String propertyValue; - - public RelatedToPropertyItem() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java index 029a4b823..07169c9ec 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/Relationship.java @@ -41,7 +41,4 @@ public class Relationship implements Serializable { @SerializedName("related-to-property") public RelatedToProperty relatedToProperty = new RelatedToProperty(); - - public Relationship() { - } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java index 2ad373104..08e41a912 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipData.java @@ -33,8 +33,13 @@ public class RelationshipData implements Serializable { */ private static final long serialVersionUID = 6809180843309562121L; @SerializedName("relationship-data") - public List<RelationshipDataItem> relationshipData = new LinkedList<>(); - - public RelationshipData() { + private List<RelationshipDataItem> relationshipDataList = new LinkedList<>(); + + public List<RelationshipDataItem> getRelationshipData() { + return relationshipDataList; + } + + public void setRelationshipData(List<RelationshipDataItem> relationshipData) { + this.relationshipDataList = relationshipData; } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java index a040f0d61..39efdcd4b 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipDataItem.java @@ -35,8 +35,4 @@ public class RelationshipDataItem implements Serializable { public String relationshipKey; @SerializedName("relationship-value") public String relationshipValue; - - public RelationshipDataItem() { - } - } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java index 8451998eb..939950561 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipItem.java @@ -34,9 +34,13 @@ public class RelationshipItem implements Serializable { private static final long serialVersionUID = 1543404460741069628L; @SerializedName("related-to-property") - public List<RelatedToPropertyItem> relatedToProperty = new LinkedList<RelatedToPropertyItem>(); - - public RelationshipItem() { + private List<RelatedToPropertyItem> relatedToProperty = new LinkedList<>(); + + public List<RelatedToPropertyItem> getRelatedToProperty() { + return relatedToProperty; } + public void setRelatedToProperty(List<RelatedToPropertyItem> relatedToProperty) { + this.relatedToProperty = relatedToProperty; + } } diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java index b31b3a6dc..46e04c8fd 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/RelationshipList.java @@ -32,8 +32,14 @@ public class RelationshipList implements Serializable { */ private static final long serialVersionUID = 6115655704973981989L; @SerializedName("relationship-list") - public List<Relationship> relationshipList = new LinkedList<>(); + private List<Relationship> relationships = new LinkedList<>(); - public RelationshipList() { + public List<Relationship> getRelationshipList() { + return relationships; } + public void setRelationshipList(List<Relationship> relationshipList) { + this.relationships = relationshipList; + } + + } |