diff options
author | vdmeer <sven.van.der.meer@ericsson.com> | 2018-01-18 12:50:32 +0000 |
---|---|---|
committer | vdmeer <sven.van.der.meer@ericsson.com> | 2018-01-18 13:44:16 +0000 |
commit | cef733a2902a600c1b4a95ef11b2f4ffc0fcbf99 (patch) | |
tree | 5eaaa6e26b3649d74fb8966cd303b8e8d9898271 /controlloop/common/model-impl/so/src/main | |
parent | bdf5640a2c68a0899363503dafa0f7cb1557e4a6 (diff) |
Fix Technical Debt, add Unit tests for SO
Converted to POJOs, fixed sona lint errors, added JUnit tests
POJOs now have only private members and getters/setters
This implicated actors, simulators, and existing tests
Issue-ID: POLICY-455
Change-Id: I4b80f729565e8675822a890892b15676908f73b4
Signed-off-by: vdmeer.sven <sven.van.der.meer@ericsson.com>
Diffstat (limited to 'controlloop/common/model-impl/so/src/main')
20 files changed, 1140 insertions, 621 deletions
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java index 97978c73f..2cc22f379 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -27,37 +27,99 @@ import com.google.gson.annotations.SerializedName; public class SOAsyncRequestStatus implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("correlator")
- public String correlator;
-
- @SerializedName("requestId")
- public String requestId;
-
- @SerializedName("instanceReferences")
- public SOInstanceReferences instanceReferences;
-
- @SerializedName("startTime")
- public LocalDateTime startTime;
-
- @SerializedName("finishTime")
- public LocalDateTime finishTime;
-
- @SerializedName("requestScope")
- public String requestScope;
-
- @SerializedName("requestType")
- public String requestType;
-
- @SerializedName("requestStatus")
- public SORequestStatus requestStatus;
-
-
- public SOAsyncRequestStatus() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("correlator")
+ private String correlator;
+
+ @SerializedName("requestId")
+ private String requestId;
+
+ @SerializedName("instanceReferences")
+ private SOInstanceReferences instanceReferences;
+
+ @SerializedName("startTime")
+ private LocalDateTime startTime;
+
+ @SerializedName("finishTime")
+ private LocalDateTime finishTime;
+
+ @SerializedName("requestScope")
+ private String requestScope;
+
+ @SerializedName("requestType")
+ private String requestType;
+
+ @SerializedName("requestStatus")
+ private SORequestStatus requestStatus;
+
+ public SOAsyncRequestStatus() {
+ // required by author
+ }
+
+ public String getCorrelator() {
+ return correlator;
+ }
+
+
+ public LocalDateTime getFinishTime() {
+ return finishTime;
+ }
+
+ public SOInstanceReferences getInstanceReferences() {
+ return instanceReferences;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public String getRequestScope() {
+ return requestScope;
+ }
+
+ public SORequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+ public String getRequestType() {
+ return requestType;
+ }
+
+ public LocalDateTime getStartTime() {
+ return startTime;
+ }
+
+ public void setCorrelator(String correlator) {
+ this.correlator = correlator;
+ }
+
+ public void setFinishTime(LocalDateTime finishTime) {
+ this.finishTime = finishTime;
+ }
+
+ public void setInstanceReferences(SOInstanceReferences instanceReferences) {
+ this.instanceReferences = instanceReferences;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+
+ public void setRequestStatus(SORequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ public void setStartTime(LocalDateTime startTime) {
+ this.startTime = startTime;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java index 6b817075f..a1233bff1 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,23 +22,36 @@ package org.onap.policy.so; import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
public class SOCloudConfiguration implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("lcpCloudRegionId")
- public String lcpCloudRegionId;
-
- @SerializedName("tenantId")
- public String tenantId;
-
- public SOCloudConfiguration() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("lcpCloudRegionId")
+ private String lcpCloudRegionId;
+
+ @SerializedName("tenantId")
+ private String tenantId;
+
+ public SOCloudConfiguration() {
+ //required by author
+ }
+
+ public String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java index 97abd3950..f2155082d 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,23 +22,36 @@ package org.onap.policy.so; import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
public class SOInstanceReferences implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("requestId")
- public String requestId;
-
- @SerializedName("instanceId")
- public String instanceId;
-
- public SOInstanceReferences() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("requestId")
+ private String requestId;
+
+ @SerializedName("instanceId")
+ private String instanceId;
+
+ public SOInstanceReferences() {
+ //requried by author
+ }
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java index e4d8af883..4b1d1d630 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * mso + * so * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -42,159 +42,176 @@ import com.google.gson.JsonSyntaxException; public final class SOManager { - private static final Logger logger = LoggerFactory.getLogger(SOManager.class); - private static final Logger netLogger = LoggerFactory.getLogger(org.onap.policy.drools.event.comm.Topic.NETWORK_LOGGER); - private static ExecutorService executors = Executors.newCachedThreadPool(); - - public static SOResponse createModuleInstance(String url, String urlBase, String username, String password, SORequest request) { - - // - // Call REST - // - Map<String, String> headers = new HashMap<String, String>(); - //headers.put("X-FromAppId", "POLICY"); - //headers.put("X-TransactionId", requestID.toString()); - headers.put("Accept", "application/json"); - - // - // 201 - CREATED - you are done just return - // - String requestJson = Serialization.gsonPretty.toJson(request); - netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, System.lineSeparator(), requestJson); - Pair<Integer, String> httpDetails = new RESTManager().post(url, username, password, headers, "application/json", requestJson); - - if (httpDetails == null) { - return null; - } - - if (httpDetails.a == 202) { - try { - SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class); - - String body = Serialization.gsonPretty.toJson(response); - logger.debug("***** Response to post:"); - logger.debug(body); - - String requestId = response.requestReferences.requestId; - int attemptsLeft = 20; - - //String getUrl = "/orchestrationRequests/v2/"+requestId; - String urlGet = urlBase + "/orchestrationRequests/v2/"+requestId; - SOResponse responseGet = null; - - while(attemptsLeft-- > 0){ - - Pair<Integer, String> httpDetailsGet = new RESTManager().get(urlGet, username, password, headers); - responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, SOResponse.class); - netLogger.info("[IN|{}|{}|]{}{}", "SO", urlGet, System.lineSeparator(), httpDetailsGet.b); - - body = Serialization.gsonPretty.toJson(responseGet); - logger.debug("***** Response to get:"); - logger.debug(body); - - if(httpDetailsGet.a == 200){ - if(responseGet.request.requestStatus.requestState.equalsIgnoreCase("COMPLETE") || - responseGet.request.requestStatus.requestState.equalsIgnoreCase("FAILED")){ - logger.debug("***** ######## VF Module Creation "+responseGet.request.requestStatus.requestState); - return responseGet; - } - } - Thread.sleep(20000); - } - - if (responseGet != null - && responseGet.request != null - && responseGet.request.requestStatus != null - && responseGet.request.requestStatus.requestState != null) { - logger.warn("***** ######## VF Module Creation timeout. Status: ( {})", responseGet.request.requestStatus.requestState); - } - - return responseGet; - } catch (JsonSyntaxException e) { - logger.error("Failed to deserialize into SOResponse: ", e); - } catch (InterruptedException e) { - logger.error("Interrupted exception: ", e); - Thread.currentThread().interrupt(); - } - } - - - - - return null; - } - - /** - * - * @param wm - * @param url - * @param urlBase - * @param username - * @param password - * @param request - * - * This method makes an asynchronous Rest call to MSO and inserts the response into the Drools working memory - */ - public void asyncSORestCall(String requestID, WorkingMemory wm, String serviceInstanceId, String vnfInstanceId, SORequest request) { - executors.submit(new Runnable() - { - @Override - public void run() - { - try { - String serverRoot = PolicyEngine.manager.getEnvironmentProperty("so.url"); - String username = PolicyEngine.manager.getEnvironmentProperty("so.username"); - String password = PolicyEngine.manager.getEnvironmentProperty("so.password"); - - String url = serverRoot + "/serviceInstances/v5/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModules"; - - String auth = username + ":" + password; - - Map<String, String> headers = new HashMap<String, String>(); - byte[] encodedBytes = Base64.getEncoder().encode(auth.getBytes()); - headers.put("Accept", "application/json"); - headers.put("Authorization", "Basic " + new String(encodedBytes)); - - Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() - .setPrettyPrinting() - .create(); - - String soJson = gsonPretty.toJson(request); - - SOResponse so = new SOResponse(); - netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, System.lineSeparator(), soJson); - Pair<Integer, String> httpResponse = new RESTManager().post(url, "policy", "policy", headers, "application/json", soJson); - - if (httpResponse != null ) { - if (httpResponse.b != null && httpResponse.a != null) { - netLogger.info("[IN|{}|{}|]{}{}", url, "SO", System.lineSeparator(), httpResponse.b); - - Gson gson = new Gson(); - so = gson.fromJson(httpResponse.b, SOResponse.class); - so.httpResponseCode = httpResponse.a; - } else { - logger.error("SO Response status/code is null."); - so.httpResponseCode = 999; - } - - } else { - logger.error("SO Response returned null."); - so.httpResponseCode = 999; - } - - SOResponseWrapper SoWrapper = new SOResponseWrapper(so, requestID); - wm.insert(SoWrapper); - logger.info("SOResponse inserted " + gsonPretty.toJson(SoWrapper)); - } catch (Exception e) { - logger.error("Error while performing asyncSORestCall: "+ e.getMessage(),e); - - // create dummy SO object to trigger cleanup - SOResponse so = new SOResponse(); - so.httpResponseCode = 999; - wm.insert(so); - } - } - }); - } + private static final Logger logger = LoggerFactory.getLogger(SOManager.class); + private static final Logger netLogger = + LoggerFactory.getLogger(org.onap.policy.drools.event.comm.Topic.NETWORK_LOGGER); + private static ExecutorService executors = Executors.newCachedThreadPool(); + + static final String MEDIA_TYPE = "application/json"; + + static final String LINE_SEPARATOR = System.lineSeparator(); + + public static SOResponse createModuleInstance(String url, String urlBase, String username, + String password, SORequest request) { + + // + // Call REST + // + Map<String, String> headers = new HashMap<>(); + headers.put("Accept", MEDIA_TYPE); + + // + // 201 - CREATED - you are done just return + // + String requestJson = Serialization.gsonPretty.toJson(request); + netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, LINE_SEPARATOR, requestJson); + Pair<Integer, String> httpDetails = + new RESTManager().post(url, username, password, headers, MEDIA_TYPE, requestJson); + + if (httpDetails == null) { + return null; + } + + if (httpDetails.a == 202) { + try { + SOResponse response = + Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class); + + String body = Serialization.gsonPretty.toJson(response); + logger.debug("***** Response to post:"); + logger.debug(body); + + String requestId = response.getRequestReferences().getRequestId(); + int attemptsLeft = 20; + + String urlGet = urlBase + "/orchestrationRequests/v2/" + requestId; + SOResponse responseGet = null; + + while (attemptsLeft-- > 0) { + + Pair<Integer, String> httpDetailsGet = + new RESTManager().get(urlGet, username, password, headers); + responseGet = + Serialization.gsonPretty.fromJson(httpDetailsGet.b, SOResponse.class); + netLogger.info("[IN|{}|{}|]{}{}", "SO", urlGet, LINE_SEPARATOR, + httpDetailsGet.b); + + body = Serialization.gsonPretty.toJson(responseGet); + logger.debug("***** Response to get:"); + logger.debug(body); + + if (httpDetailsGet.a == 200) { + if (responseGet.getRequest().getRequestStatus().getRequestState() + .equalsIgnoreCase("COMPLETE") + || responseGet.getRequest().getRequestStatus().getRequestState() + .equalsIgnoreCase("FAILED")) { + logger.debug("***** ######## VF Module Creation {}", + responseGet.getRequest().getRequestStatus().getRequestState()); + return responseGet; + } + } + Thread.sleep(20000); + } + + if (responseGet != null && responseGet.getRequest() != null + && responseGet.getRequest().getRequestStatus() != null + && responseGet.getRequest().getRequestStatus().getRequestState() != null) { + logger.warn("***** ######## VF Module Creation timeout. Status: ( {})", + responseGet.getRequest().getRequestStatus().getRequestState()); + } + + return responseGet; + } + catch (JsonSyntaxException e) { + logger.error("Failed to deserialize into SOResponse: ", e); + } + catch (InterruptedException e) { + logger.error("Interrupted exception: ", e); + Thread.currentThread().interrupt(); + } + } + + + + return null; + } + + /** + * + * @param wm + * @param url + * @param urlBase + * @param username + * @param password + * @param request + * + * This method makes an asynchronous Rest call to MSO and inserts the response into the + * Drools working memory + */ + public void asyncSORestCall(String requestID, WorkingMemory wm, String serviceInstanceId, + String vnfInstanceId, SORequest request) { + executors.submit(new Runnable() { + @Override + public void run() { + try { + String serverRoot = PolicyEngine.manager.getEnvironmentProperty("so.url"); + String username = PolicyEngine.manager.getEnvironmentProperty("so.username"); + String password = PolicyEngine.manager.getEnvironmentProperty("so.password"); + + String url = serverRoot + "/serviceInstances/v5/" + serviceInstanceId + "/vnfs/" + + vnfInstanceId + "/vfModules"; + + String auth = username + ":" + password; + + Map<String, String> headers = new HashMap<>(); + byte[] encodedBytes = Base64.getEncoder().encode(auth.getBytes()); + headers.put("Accept", MEDIA_TYPE); + headers.put("Authorization", "Basic " + new String(encodedBytes)); + + Gson gsonPretty = + new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); + + String soJson = gsonPretty.toJson(request); + + SOResponse so = new SOResponse(); + netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, LINE_SEPARATOR, soJson); + Pair<Integer, String> httpResponse = new RESTManager().post(url, "policy", + "policy", headers, MEDIA_TYPE, soJson); + + if (httpResponse != null) { + if (httpResponse.b != null && httpResponse.a != null) { + netLogger.info("[IN|{}|{}|]{}{}", url, "SO", LINE_SEPARATOR, + httpResponse.b); + + Gson gson = new Gson(); + so = gson.fromJson(httpResponse.b, SOResponse.class); + so.setHttpResponseCode(httpResponse.a); + } + else { + logger.error("SO Response status/code is null."); + so.setHttpResponseCode(999); + } + + } + else { + logger.error("SO Response returned null."); + so.setHttpResponseCode(999); + } + + SOResponseWrapper soWrapper = new SOResponseWrapper(so, requestID); + wm.insert(soWrapper); + logger.info("SOResponse inserted " + gsonPretty.toJson(soWrapper)); + } + catch (Exception e) { + logger.error("Error while performing asyncSORestCall: " + e.getMessage(), e); + + // create dummy SO object to trigger cleanup + SOResponse so = new SOResponse(); + so.setHttpResponseCode(999); + wm.insert(so); + } + } + }); + } } diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java index c6e138a2a..eb257a7e9 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * mso + * so * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -22,38 +22,91 @@ package org.onap.policy.so; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class SOModelInfo implements Serializable { - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("modelType") - public String modelType; - - @SerializedName("modelInvariantId") - public String modelInvariantId; - - @SerializedName("modelVersionId") - public String modelVersionId; - - @SerializedName("modelName") - public String modelName; - - @SerializedName("modelVersion") - public String modelVersion; - - @SerializedName("modelCustomizationName") - public String modelCustomizationName; - - @SerializedName("modelCustomizationId") - public String modelCustomizationId; - - public SOModelInfo() { - } + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("modelType") + private String modelType; + + @SerializedName("modelInvariantId") + private String modelInvariantId; + + @SerializedName("modelVersionId") + private String modelVersionId; + + @SerializedName("modelName") + private String modelName; + + @SerializedName("modelVersion") + private String modelVersion; + + @SerializedName("modelCustomizationName") + private String modelCustomizationName; + + @SerializedName("modelCustomizationId") + private String modelCustomizationId; + + public SOModelInfo() { + //required by author + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public String getModelCustomizationName() { + return modelCustomizationName; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public String getModelName() { + return modelName; + } + + public String getModelType() { + return modelType; + } + + public String getModelVersion() { + return modelVersion; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public void setModelType(String modelType) { + this.modelType = modelType; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } } diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java index 150733963..7065feaac 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -26,18 +26,32 @@ import com.google.gson.annotations.SerializedName; public class SOPolicyException implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("messageId")
- public String messageId;
-
- @SerializedName("text")
- public String text;
-
- public SOPolicyException() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("messageId")
+ private String messageId;
+
+ @SerializedName("text")
+ private String text;
+
+ public SOPolicyException() {
+ //required by author
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java index ac737307c..2bd46e04c 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,28 +22,49 @@ package org.onap.policy.so; import java.io.Serializable;
-
-
import com.google.gson.annotations.SerializedName;
public class SORelatedInstance implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("instanceId")
- public String instanceId;
-
- @SerializedName("instanceName")
- public String instanceName;
-
- @SerializedName("modelInfo")
- public SOModelInfo modelInfo;
-
-
- public SORelatedInstance() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceId")
+ private String instanceId;
+
+ @SerializedName("instanceName")
+ private String instanceName;
+
+ @SerializedName("modelInfo")
+ private SOModelInfo modelInfo;
+
+ public SORelatedInstance() {
+ //required by author
+ }
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public SOModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+
+ public void setModelInfo(SOModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java index c4b85ab52..71fb11949 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,21 +22,25 @@ package org.onap.policy.so; import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
public class SORelatedInstanceListElement implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("relatedInstance")
+ private SORelatedInstance relatedInstance;
+
+ public SORelatedInstanceListElement() {
+ //required by author
+ }
+
+ public SORelatedInstance getRelatedInstance() {
+ return relatedInstance;
+ }
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("relatedInstance")
- public SORelatedInstance relatedInstance;
-
-
- public SORelatedInstanceListElement() {
- }
+ public void setRelatedInstance(SORelatedInstance relatedInstance) {
+ this.relatedInstance = relatedInstance;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java index 3e90ff345..be5ef139a 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -28,34 +28,87 @@ import com.google.gson.annotations.SerializedName; public class SORequest implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("requestId")
- public UUID requestId;
-
- @SerializedName("startTime")
- //public LocalDateTime startTime;
- public String startTime;
-
- @SerializedName("finishTime")
- public LocalDateTime finishTime;
-
- @SerializedName("requestScope")
- public String requestScope;
-
- @SerializedName("requestType")
- public String requestType;
-
- @SerializedName("requestDetails")
- public SORequestDetails requestDetails;
-
- @SerializedName("requestStatus")
- public SORequestStatus requestStatus;
-
- public SORequest() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("requestId")
+ private UUID requestId;
+
+ @SerializedName("startTime")
+ private String startTime;
+
+ @SerializedName("finishTime")
+ private LocalDateTime finishTime;
+
+ @SerializedName("requestScope")
+ private String requestScope;
+
+ @SerializedName("requestType")
+ private String requestType;
+
+ @SerializedName("requestDetails")
+ private SORequestDetails requestDetails;
+
+ @SerializedName("requestStatus")
+ private SORequestStatus requestStatus;
+
+ public SORequest() {
+ // required by author
+ }
+
+ public LocalDateTime getFinishTime() {
+ return finishTime;
+ }
+
+ public SORequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ public UUID getRequestId() {
+ return requestId;
+ }
+
+ public String getRequestScope() {
+ return requestScope;
+ }
+
+ public SORequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+ public String getRequestType() {
+ return requestType;
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public void setFinishTime(LocalDateTime finishTime) {
+ this.finishTime = finishTime;
+ }
+
+ public void setRequestDetails(SORequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ public void setRequestId(UUID requestId) {
+ this.requestId = requestId;
+ }
+
+ public void setRequestScope(String requestScope) {
+ this.requestScope = requestScope;
+ }
+
+ public void setRequestStatus(SORequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java index ab4afc16c..a86418198 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * mso + * so * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -28,97 +28,143 @@ import com.google.gson.annotations.SerializedName; public class SORequestDetails implements Serializable { - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("modelInfo") - public SOModelInfo modelInfo; - - @SerializedName("cloudConfiguration") - public SOCloudConfiguration cloudConfiguration; - - @SerializedName("requestInfo") - public SORequestInfo requestInfo; - - @SerializedName("subscriberInfo") - public SOSubscriberInfo subscriberInfo; - - @SerializedName("relatedInstanceList") - public List<SORelatedInstanceListElement> relatedInstanceList= new LinkedList<SORelatedInstanceListElement>(); - - @SerializedName("requestParameters") - public SORequestParameters requestParameters; - - public SORequestDetails() { - - } - - public SORequestDetails(SORequestDetails soRequestDetails) { - this.modelInfo = soRequestDetails.modelInfo; - this.cloudConfiguration = soRequestDetails.cloudConfiguration; - this.requestInfo = soRequestDetails.requestInfo; - this.relatedInstanceList = soRequestDetails.relatedInstanceList; - this.requestParameters = soRequestDetails.requestParameters; - } - - @Override - public String toString() { - return "SORequestDetails [modelInfo=" + modelInfo - + ", cloudConfiguration=" + cloudConfiguration - + ", requestInfo=" + requestInfo + ", relatedInstanceList=" - + relatedInstanceList + ", requestParameters=" - + requestParameters + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode()); - result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode()); - result = prime * result + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode()); - result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode()); - result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SORequestDetails other = (SORequestDetails) obj; - if (cloudConfiguration == null) { - if (other.cloudConfiguration != null) - return false; - } else if (!cloudConfiguration.equals(other.cloudConfiguration)) - return false; - if (modelInfo == null) { - if (other.modelInfo != null) - return false; - } else if (!modelInfo.equals(other.modelInfo)) - return false; - if (relatedInstanceList == null) { - if (other.relatedInstanceList != null) - return false; - } else if (!relatedInstanceList.equals(other.relatedInstanceList)) - return false; - if (requestInfo == null) { - if (other.requestInfo != null) - return false; - } else if (!requestInfo.equals(other.requestInfo)) - return false; - if (requestParameters == null) { - if (other.requestParameters != null) - return false; - } else if (!requestParameters.equals(other.requestParameters)) - return false; - return true; - } - + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("modelInfo") + private SOModelInfo modelInfo; + + @SerializedName("cloudConfiguration") + private SOCloudConfiguration cloudConfiguration; + + @SerializedName("requestInfo") + private SORequestInfo requestInfo; + + @SerializedName("subscriberInfo") + private SOSubscriberInfo subscriberInfo; + + @SerializedName("relatedInstanceList") + private List<SORelatedInstanceListElement> relatedInstanceList = new LinkedList<>(); + + @SerializedName("requestParameters") + private SORequestParameters requestParameters; + + public SORequestDetails() { + + } + + public SORequestDetails(SORequestDetails soRequestDetails) { + this.modelInfo = soRequestDetails.modelInfo; + this.cloudConfiguration = soRequestDetails.cloudConfiguration; + this.requestInfo = soRequestDetails.requestInfo; + this.relatedInstanceList = soRequestDetails.relatedInstanceList; + this.requestParameters = soRequestDetails.requestParameters; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + SORequestDetails other = (SORequestDetails) obj; + if (cloudConfiguration == null) { + if (other.cloudConfiguration != null) + return false; + } + else if (!cloudConfiguration.equals(other.cloudConfiguration)) + return false; + if (modelInfo == null) { + if (other.modelInfo != null) + return false; + } + else if (!modelInfo.equals(other.modelInfo)) + return false; + if (relatedInstanceList == null) { + if (other.relatedInstanceList != null) + return false; + } + else if (!relatedInstanceList.equals(other.relatedInstanceList)) + return false; + if (requestInfo == null) { + if (other.requestInfo != null) + return false; + } + else if (!requestInfo.equals(other.requestInfo)) + return false; + if (requestParameters == null) { + if (other.requestParameters != null) + return false; + } + else if (!requestParameters.equals(other.requestParameters)) + return false; + return true; + } + + public SOCloudConfiguration getCloudConfiguration() { + return cloudConfiguration; + } + + public SOModelInfo getModelInfo() { + return modelInfo; + } + + public List<SORelatedInstanceListElement> getRelatedInstanceList() { + return relatedInstanceList; + } + + public SORequestInfo getRequestInfo() { + return requestInfo; + } + + public SORequestParameters getRequestParameters() { + return requestParameters; + } + + public SOSubscriberInfo getSubscriberInfo() { + return subscriberInfo; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode()); + result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode()); + result = prime * result + + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode()); + result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode()); + result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode()); + return result; + } + + public void setCloudConfiguration(SOCloudConfiguration cloudConfiguration) { + this.cloudConfiguration = cloudConfiguration; + } + + public void setModelInfo(SOModelInfo modelInfo) { + this.modelInfo = modelInfo; + } + + public void setRequestInfo(SORequestInfo requestInfo) { + this.requestInfo = requestInfo; + } + + public void setRequestParameters(SORequestParameters requestParameters) { + this.requestParameters = requestParameters; + } + + public void setSubscriberInfo(SOSubscriberInfo subscriberInfo) { + this.subscriberInfo = subscriberInfo; + } + + @Override + public String toString() { + return "SORequestDetails [modelInfo=" + modelInfo + ", cloudConfiguration=" + + cloudConfiguration + ", requestInfo=" + requestInfo + ", relatedInstanceList=" + + relatedInstanceList + ", requestParameters=" + requestParameters + "]"; + } + } diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java index d49897c72..c9dad036a 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -26,34 +26,32 @@ import com.google.gson.annotations.SerializedName; public class SORequestError implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
-
- @SerializedName("policyException")
- public SOPolicyException policyException;
-
-
- @SerializedName("serviceException")
- public SOServiceException serviceException;
-
- /*
- @SerializedName("messageId")
- public String messageId;
-
- @SerializedName("text")
- public String text;
-
- @SerializedName("url")
- public String url;
-
- @SerializedName("variables")
- public String variables;
- */
-
- public SORequestError() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("policyException")
+ private SOPolicyException policyException;
+
+ @SerializedName("serviceException")
+ private SOServiceException serviceException;
+
+ public SORequestError() {
+ // required by author
+ }
+
+ public SOPolicyException getPolicyException() {
+ return policyException;
+ }
+
+ public SOServiceException getServiceException() {
+ return serviceException;
+ }
+
+ public void setPolicyException(SOPolicyException policyException) {
+ this.policyException = policyException;
+ }
+
+ public void setServiceException(SOServiceException serviceException) {
+ this.serviceException = serviceException;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java index 2e7beab16..28bc0b87e 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,47 +22,124 @@ package org.onap.policy.so; import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
public class SORequestInfo implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("instanceName")
- public String instanceName;
-
- @SerializedName("source")
- public String source;
-
- @SerializedName("productFamilyId")
- public String productFamilyId;
-
- @SerializedName("suppressRollback")
- public boolean suppressRollback;
-
- @SerializedName("billingAccountNumber")
- public String billingAccountNumber;
-
- @SerializedName("callbackUrl")
- public String callbackUrl;
-
- @SerializedName("correlator")
- public String correlator;
-
- @SerializedName("orderNumber")
- public String orderNumber;
-
- @SerializedName("orderVersion")
- public Integer orderVersion;
-
- @SerializedName("requestorId")
- public String requestorId;
-
- public SORequestInfo() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceName")
+ private String instanceName;
+
+ @SerializedName("source")
+ private String source;
+
+ @SerializedName("productFamilyId")
+ private String productFamilyId;
+
+ @SerializedName("suppressRollback")
+ private boolean suppressRollback;
+
+ @SerializedName("billingAccountNumber")
+ private String billingAccountNumber;
+
+ @SerializedName("callbackUrl")
+ private String callbackUrl;
+
+ @SerializedName("correlator")
+ private String correlator;
+
+ @SerializedName("orderNumber")
+ private String orderNumber;
+
+ @SerializedName("orderVersion")
+ private Integer orderVersion;
+
+ @SerializedName("requestorId")
+ private String requestorId;
+
+ public SORequestInfo() {
+ // required by author
+ }
+
+ public String getBillingAccountNumber() {
+ return billingAccountNumber;
+ }
+
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ public String getCorrelator() {
+ return correlator;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public String getOrderNumber() {
+ return orderNumber;
+ }
+
+ public Integer getOrderVersion() {
+ return orderVersion;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public boolean isSuppressRollback() {
+ return suppressRollback;
+ }
+
+ public void setBillingAccountNumber(String billingAccountNumber) {
+ this.billingAccountNumber = billingAccountNumber;
+ }
+
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ public void setCorrelator(String correlator) {
+ this.correlator = correlator;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public void setOrderNumber(String orderNumber) {
+ this.orderNumber = orderNumber;
+ }
+
+ public void setOrderVersion(Integer orderVersion) {
+ this.orderVersion = orderVersion;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public void setSuppressRollback(boolean suppressRollback) {
+ this.suppressRollback = suppressRollback;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java index c66f0979c..c1a6c7d85 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -25,23 +25,36 @@ import java.util.LinkedList; import java.util.List;
import java.util.Map;
-
import com.google.gson.annotations.SerializedName;
public class SORequestParameters implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("subscriptionServiceType")
- public String subscriptionServiceType;
-
- @SerializedName("userParams")
- public List<Map<String, String>> userParams = new LinkedList<Map<String, String>>();
-
- public SORequestParameters() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @SerializedName("userParams")
+ private List<Map<String, String>> userParams = new LinkedList<>();
+
+ public SORequestParameters() {
+ // required by author
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public List<Map<String, String>> getUserParams() {
+ return userParams;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public void setUserParams(List<Map<String, String>> userParams) {
+ this.userParams = userParams;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java index f3e15e1d7..913402db3 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,17 +22,32 @@ package org.onap.policy.so; import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
public class SORequestReferences implements Serializable {
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("instanceId")
- public String instanceId;
-
- @SerializedName("requestId")
- public String requestId;
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceId")
+ private String instanceId;
+
+ @SerializedName("requestId")
+ private String requestId;
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java index 4b57fc7ba..8c5e7848c 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -26,26 +26,57 @@ import com.google.gson.annotations.SerializedName; public class SORequestStatus implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("percentProgress")
- public int percentProgress;
-
- @SerializedName("requestState")
- public String requestState;
-
- @SerializedName("timestamp")
- //public LocalDateTime timestamp;
- public String timestamp;
-
- @SerializedName("wasRolledBack")
- public boolean wasRolledBack;
-
-
- public SORequestStatus() {
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("percentProgress")
+ private int percentProgress;
+
+ @SerializedName("requestState")
+ private String requestState;
+
+ @SerializedName("timestamp")
+ private String timestamp;
+
+ @SerializedName("wasRolledBack")
+ private boolean wasRolledBack;
+
+ public SORequestStatus() {
+ //required by author
+ }
+
+ public int getPercentProgress() {
+ return percentProgress;
+ }
+
+ public String getRequestState() {
+ return requestState;
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public boolean isWasRolledBack() {
+ return wasRolledBack;
+ }
+
+ public void setPercentProgress(int percentProgress) {
+ this.percentProgress = percentProgress;
+ }
+
+ public void setRequestState(String requestState) {
+ this.requestState = requestState;
+ }
+
+ public void setTimestamp(String timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public void setWasRolledBack(boolean wasRolledBack) {
+ this.wasRolledBack = wasRolledBack;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java index c5c3737b2..20e0c4155 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * mso + * so * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -26,24 +26,53 @@ import com.google.gson.annotations.SerializedName; public class SOResponse implements Serializable { - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestReferences") - public SORequestReferences requestReferences; - - @SerializedName("requestError") - public SORequestError requestError; - - @SerializedName("request") - public SORequest request; - - public int httpResponseCode; - - - public SOResponse() { - } + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("requestReferences") + private SORequestReferences requestReferences; + + @SerializedName("requestError") + private SORequestError requestError; + + @SerializedName("request") + private SORequest request; + + private int httpResponseCode; + + public SOResponse() { + // required by author + } + + public int getHttpResponseCode() { + return httpResponseCode; + } + + public SORequest getRequest() { + return request; + } + + public SORequestError getRequestError() { + return requestError; + } + + public SORequestReferences getRequestReferences() { + return requestReferences; + } + + public void setHttpResponseCode(int httpResponseCode) { + this.httpResponseCode = httpResponseCode; + } + + public void setRequest(SORequest request) { + this.request = request; + } + + public void setRequestError(SORequestError requestError) { + this.requestError = requestError; + } + + public void setRequestReferences(SORequestReferences requestReferences) { + this.requestReferences = requestReferences; + } } diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java index 3b82edf5b..184ae5ef1 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponseWrapper.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * mso + * so * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -26,30 +26,16 @@ import com.google.gson.annotations.SerializedName; public class SOResponseWrapper implements Serializable { - private static final long serialVersionUID = 7673023687132889069L; - - @SerializedName("SOResponse") - public SOResponse SOResponse; - public transient String requestID; - + private static final long serialVersionUID = 7673023687132889069L; + + @SerializedName("SoResponse") + private SOResponse SoResponse; + + private transient String requestID; public SOResponseWrapper(SOResponse response, String reqID) { - this.SOResponse = response; - this.requestID = reqID; - } - - @Override - public String toString() { - return "SOResponseWrapper [SOResponse=" + SOResponse + ", RequestID=" + requestID + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((SOResponse == null) ? 0 : SOResponse.hashCode()); - result = prime * result + ((requestID == null) ? 0 : requestID.hashCode()); - return result; + this.SoResponse = response; + this.requestID = reqID; } @Override @@ -58,27 +44,59 @@ public class SOResponseWrapper implements Serializable { return true; } if (obj == null) { - return false; + return false; } if (getClass() != obj.getClass()) { return false; } SOResponseWrapper other = (SOResponseWrapper) obj; - if (SOResponse == null) { - if (other.SOResponse != null) { + if (SoResponse == null) { + if (other.SoResponse != null) { return false; } - } else if (!SOResponse.equals(other.SOResponse)) { + } + else if (!SoResponse.equals(other.SoResponse)) { return false; } if (requestID == null) { if (other.requestID != null) { return false; } - } else if (!requestID.equals(other.requestID)) { + } + else if (!requestID.equals(other.requestID)) { return false; } return true; } + public String getRequestID() { + return requestID; + } + + public SOResponse getSoResponse() { + return SoResponse; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((SoResponse == null) ? 0 : SoResponse.hashCode()); + result = prime * result + ((requestID == null) ? 0 : requestID.hashCode()); + return result; + } + + public void setRequestID(String requestID) { + this.requestID = requestID; + } + + public void setSoResponse(SOResponse sOResponse) { + SoResponse = sOResponse; + } + + @Override + public String toString() { + return "SOResponseWrapper [SOResponse=" + SoResponse + ", RequestID=" + requestID + "]"; + } + } diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java index 58999fd30..3290f2e41 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -28,21 +28,39 @@ import com.google.gson.annotations.SerializedName; public class SOServiceException implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("messageId")
- public String messageId;
-
- @SerializedName("text")
- public String text;
-
- @SerializedName("variables")
- public List<String> variables = new LinkedList<String>();
-
- public SOServiceException() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("messageId")
+ private String messageId;
+
+ @SerializedName("text")
+ private String text;
+
+ @SerializedName("variables")
+ private List<String> variables = new LinkedList<>();
+
+ public SOServiceException() {
+ // required by author
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public List<String> getVariables() {
+ return variables;
+ }
+
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java index 745e237fe..14c46b0c1 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java @@ -1,6 +1,6 @@ /*-
* ============LICENSE_START=======================================================
- * mso
+ * so
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -22,26 +22,47 @@ package org.onap.policy.so; import java.io.Serializable;
-
import com.google.gson.annotations.SerializedName;
public class SOSubscriberInfo implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("globalSubscriberId")
- public String globalSubscriberId;
-
- @SerializedName("subscriberCommonSiteId")
- public String subscriberCommonSiteId;
-
- @SerializedName("subscriberName")
- public String subscriberName;
-
- public SOSubscriberInfo() {
- }
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @SerializedName("subscriberCommonSiteId")
+ private String subscriberCommonSiteId;
+
+ @SerializedName("subscriberName")
+ private String subscriberName;
+
+ public SOSubscriberInfo() {
+ //required by author
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public String getSubscriberCommonSiteId() {
+ return subscriberCommonSiteId;
+ }
+
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public void setSubscriberCommonSiteId(String subscriberCommonSiteId) {
+ this.subscriberCommonSiteId = subscriberCommonSiteId;
+ }
+
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
}
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java index c9d013ea6..9bcd5e5c9 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java @@ -24,9 +24,12 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; public final class Serialization { - - final static public Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() - .setPrettyPrinting() - .create(); + public static final Gson gsonPretty = + new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create(); + + private Serialization() { + // utility class with explicit private constructor + // change if class is more than utility + } } |