From 3d372e317bff5fe7e27296cab4ed76e759f86994 Mon Sep 17 00:00:00 2001 From: Rashmi Pujar Date: Tue, 5 Nov 2019 17:10:00 -0500 Subject: Use lombok annotations for objects in models-interaction/models-impl module Issue-ID: POLICY-1896 Signed-off-by: Rashmi Pujar Change-Id: I425afe25876cea91908391418582ef584e6fe6fc --- .../java/org/onap/policy/sdnr/PciCommonHeader.java | 129 ++------------------- .../main/java/org/onap/policy/sdnr/PciRequest.java | 14 +-- .../org/onap/policy/sdnr/PciRequestWrapper.java | 36 ++---- .../java/org/onap/policy/sdnr/PciResponse.java | 66 ++--------- .../org/onap/policy/sdnr/PciResponseWrapper.java | 35 ++---- .../main/java/org/onap/policy/sdnr/PciWrapper.java | 106 ++--------------- .../src/main/java/org/onap/policy/sdnr/Status.java | 30 ++--- 7 files changed, 50 insertions(+), 366 deletions(-) (limited to 'models-interactions/model-impl/sdnr') diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java index 8552bb23c..cdafa6858 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java @@ -29,7 +29,11 @@ import java.time.Instant; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class PciCommonHeader implements Serializable { private static final long serialVersionUID = 5435363539127062114L; @@ -66,6 +70,7 @@ public class PciCommonHeader implements Serializable { this.timeStamp = commonHeader.timeStamp; this.requestId = commonHeader.requestId; this.subRequestId = commonHeader.subRequestId; + this.apiVer = commonHeader.getApiVer(); if (commonHeader.requestTrack != null) { this.requestTrack.putAll(commonHeader.requestTrack); } @@ -74,120 +79,6 @@ public class PciCommonHeader implements Serializable { } } - /** - * Get the timestamp. - * - * @return the timeStamp - */ - public Instant getTimeStamp() { - return timeStamp; - } - - /** - * Set the timestamp. - * - * @param timeStamp - * the timeStamp to set - */ - public void setTimeStamp(Instant timeStamp) { - this.timeStamp = timeStamp; - } - - /** - * Get the API version. - * - * @return the apiVer - */ - public String getApiVer() { - return apiVer; - } - - /** - * Set the API version. - * - * @param apiVer - * the apiVer to set - */ - public void setApiVer(String apiVer) { - this.apiVer = apiVer; - } - - /** - * Get the request Id. - * - * @return the requestId - */ - public UUID getRequestId() { - return requestId; - } - - /** - * Set the request Id. - * - * @param requestId - * the requestId to set - */ - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - /** - * Get the sub request Id. - * - * @return the subRequestId - */ - public String getSubRequestId() { - return subRequestId; - } - - /** - * Set the sub request Id. - * - * @param subRequestId - * the subRequestId to set - */ - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } - - /** - * Set the request track. - * - * @param requestTrack - * the requestTrack to set - */ - public void setRequestTrack(Map requestTrack) { - this.requestTrack = requestTrack; - } - - /** - * Get the request track. - * - * @return the requestTrack - */ - public Map getRequestTrack() { - return requestTrack; - } - - /** - * Get the flags. - * - * @return the flags - */ - public Map getFlags() { - return flags; - } - - /** - * Set the flags. - * - * @param flags - * the flags to set - */ - public void setFlags(Map flags) { - this.flags = flags; - } - @Override public String toString() { return "CommonHeader [timeStamp=" + timeStamp + ", apiVer=" + apiVer @@ -256,13 +147,9 @@ public class PciCommonHeader implements Serializable { return false; } if (timeStamp == null) { - if (other.timeStamp != null) { - return false; - } - } else if (!timeStamp.equals(other.timeStamp)) { - return false; + return other.timeStamp == null; + } else { + return timeStamp.equals(other.timeStamp); } - return true; } - } diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java index d76dd88b5..d1430a7dc 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java @@ -25,7 +25,11 @@ package org.onap.policy.sdnr; import com.google.gson.annotations.SerializedName; import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class PciRequest implements Serializable { private static final long serialVersionUID = 323235565922846624L; @@ -133,13 +137,9 @@ public class PciRequest implements Serializable { return false; } if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; + return other.payload == null; + } else { + return payload.equals(other.payload); } - return true; } - } diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java index b762b5032..4de3a0d30 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequestWrapper.java @@ -21,15 +21,16 @@ package org.onap.policy.sdnr; -import com.google.gson.annotations.SerializedName; - import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class PciRequestWrapper extends PciWrapper implements Serializable { private static final long serialVersionUID = 879766924715980798L; - @SerializedName(value = "body") private PciRequest body; public PciRequestWrapper() { @@ -40,25 +41,6 @@ public class PciRequestWrapper extends PciWrapper implements Serializable { body = request; } - /** - * Get the body. - * - * @return the body - */ - public PciRequest getBody() { - return body; - } - - /** - * Set the body. - * - * @param body - * the body to set - */ - public void setBody(PciRequest body) { - this.body = body; - } - @Override public String toString() { return "RequestWrapper [body=" + body + ", toString()=" + super.toString() + "]"; @@ -85,13 +67,9 @@ public class PciRequestWrapper extends PciWrapper implements Serializable { } PciRequestWrapper other = (PciRequestWrapper) obj; if (body == null) { - if (other.body != null) { - return false; - } - } else if (!body.equals(other.body)) { - return false; + return other.body == null; + } else { + return body.equals(other.body); } - return true; } - } diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java index b9b8f9b44..0bc2eb4cf 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponse.java @@ -24,7 +24,11 @@ package org.onap.policy.sdnr; import com.google.gson.annotations.SerializedName; import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class PciResponse implements Serializable { private static final long serialVersionUID = 8375708697287669750L; @@ -51,59 +55,6 @@ public class PciResponse implements Serializable { */ public PciResponse(PciRequest request) { this.commonHeader = new PciCommonHeader(request.getCommonHeader()); - - } - - /** - * Get the common header. - * - * @return the commonHeader - */ - public PciCommonHeader getCommonHeader() { - return commonHeader; - } - - /** - * Set the common header. - * - * @param commonHeader - * the commonHeader to set - */ - public void setCommonHeader(PciCommonHeader commonHeader) { - this.commonHeader = commonHeader; - } - - /** - * Get the status. - * - * @return the status - */ - public Status getStatus() { - return status; - } - - /** - * Set the status. - * - * @param status - * the status to set - */ - public void setStatus(Status status) { - this.status = status; - } - - /** - * Get the payload. - * - * @return the payload - */ - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; } @Override @@ -149,12 +100,9 @@ public class PciResponse implements Serializable { return false; } if (status == null) { - if (other.status != null) { - return false; - } - } else if (!status.equals(other.status)) { - return false; + return other.status == null; + } else { + return status.equals(other.status); } - return true; } } diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java index cf2e1e32b..e1613645d 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciResponseWrapper.java @@ -21,40 +21,22 @@ package org.onap.policy.sdnr; -import com.google.gson.annotations.SerializedName; - import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class PciResponseWrapper extends PciWrapper implements Serializable { private static final long serialVersionUID = 109837814781086802L; - @SerializedName(value = "body") private PciResponse body; public PciResponseWrapper() { super(); } - /** - * Get the body. - * - * @return the body - */ - public PciResponse getBody() { - return body; - } - - /** - * Set the body. - * - * @param body - * the body to set - */ - public void setBody(PciResponse body) { - this.body = body; - } - @Override public String toString() { return "ResponseWrapper [body=" + body + ", toString()=" + super.toString() + "]"; @@ -81,12 +63,9 @@ public class PciResponseWrapper extends PciWrapper implements Serializable { } PciResponseWrapper other = (PciResponseWrapper) obj; if (body == null) { - if (other.body != null) { - return false; - } - } else if (!body.equals(other.body)) { - return false; + return other.body == null; + } else { + return body.equals(other.body); } - return true; } } diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java index fd9bb937f..cf0a8a711 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciWrapper.java @@ -24,12 +24,15 @@ package org.onap.policy.sdnr; import com.google.gson.annotations.SerializedName; import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class PciWrapper implements Serializable { private static final long serialVersionUID = 375215806432396532L; - @SerializedName(value = "version") private String version; @SerializedName(value = "cambria-partition") @@ -41,103 +44,12 @@ public class PciWrapper implements Serializable { @SerializedName(value = "correlation-id") private String correlationId; - @SerializedName(value = "type") private String type; public PciWrapper() { // Create a default PciWrapper instance } - /** - * Get the version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Set the version. - * - * @param version the version to set - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * Get the cambria partition. - * - * @return the cambriaPartition - */ - public String getCambriaPartition() { - return cambriaPartition; - } - - /** - * Set the cambria partition. - * - * @param cambriaPartition the cambriaPartition to set - */ - public void setCambriaPartition(String cambriaPartition) { - this.cambriaPartition = cambriaPartition; - } - - /** - * Get the RPN name. - * - * @return the rpcName - */ - public String getRpcName() { - return rpcName; - } - - /** - * Set the RPC name. - * - * @param rpcName the rpcName to set - */ - public void setRpcName(String rpcName) { - this.rpcName = rpcName; - } - - /** - * Get the correlation Id. - * - * @return the correlationId - */ - public String getCorrelationId() { - return correlationId; - } - - /** - * Set the correclation Id. - * - * @param correlationId the correlationId to set - */ - public void setCorrelationId(String correlationId) { - this.correlationId = correlationId; - } - - /** - * Get the type. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Set the type. - * - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - @Override public String toString() { return "Wrapper [version=" + version + ", cambriaPartition=" + cambriaPartition + ", rpcName=" + rpcName @@ -197,13 +109,9 @@ public class PciWrapper implements Serializable { return false; } if (version == null) { - if (other.version != null) { - return false; - } - } else if (!version.equals(other.version)) { - return false; + return other.version == null; + } else { + return version.equals(other.version); } - return true; } - } diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java index 7b975cf65..a8fe379e7 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/Status.java @@ -24,7 +24,11 @@ package org.onap.policy.sdnr; import com.google.gson.annotations.SerializedName; import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class Status implements Serializable { private static final long serialVersionUID = 877641506135467199L; @@ -49,22 +53,6 @@ public class Status implements Serializable { this.value = value; } - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - @Override public String toString() { return "Status [code = " + code + ", value = " + value + "]"; @@ -95,13 +83,9 @@ public class Status implements Serializable { return false; } if (value == null) { - if (other.value != null) { - return false; - } - } else if (!value.equals(other.value)) { - return false; + return other.value == null; + } else { + return value.equals(other.value); } - return true; } - } -- cgit 1.2.3-korg