From 8884e6f236ac39f5a2f5b96d78cc2457351f2bd5 Mon Sep 17 00:00:00 2001 From: HuabingZhao Date: Wed, 18 Oct 2017 14:08:18 +0800 Subject: Remove duplicated class variable Issue-Id: MSB-91 Change-Id: I66b7b80dc51ab726703c94e4e73a8f6d8b2c3593 Signed-off-by: HuabingZhao --- .../sdk/discovery/entity/MicroServiceFullInfo.java | 81 ++++++++++------------ .../msb/sdk/discovery/entity/MicroServiceInfo.java | 42 +++++------ 2 files changed, 51 insertions(+), 72 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceFullInfo.java b/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceFullInfo.java index e874962..58d9c81 100644 --- a/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceFullInfo.java +++ b/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceFullInfo.java @@ -20,59 +20,48 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) public class MicroServiceFullInfo extends Service implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private Set nodes; + // Reserved + private String status = "1"; - //Reserved - private String status = "1"; - - public Set getNodes() { - return nodes; - } - - public void setNodes(Set nodes) { - this.nodes = nodes; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } - public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append("MicroService List:").append("\r\n");; - buf.append("serviceName:").append(getServiceName()).append("\r\n"); - buf.append("version:").append(getVersion()).append("\r\n"); - buf.append("url:").append(getUrl()).append("\r\n"); - buf.append("protocol:").append(getProtocol()).append("\r\n"); - buf.append("visualRange:").append(getVisualRange()).append("\r\n"); - buf.append("nodes:").append("\r\n"); + public String toString() { + StringBuffer buf = new StringBuffer(); + buf.append("MicroService List:").append("\r\n");; + buf.append("serviceName:").append(getServiceName()).append("\r\n"); + buf.append("version:").append(getVersion()).append("\r\n"); + buf.append("url:").append(getUrl()).append("\r\n"); + buf.append("protocol:").append(getProtocol()).append("\r\n"); + buf.append("visualRange:").append(getVisualRange()).append("\r\n"); + buf.append("nodes:").append("\r\n"); - for (NodeInfo nodeInstace : this.nodes) { - buf.append(" nodeId-").append(nodeInstace.getNodeId()).append("\r\n"); - buf.append(" ip-").append(nodeInstace.getIp()).append("\r\n"); - buf.append(" port-").append(nodeInstace.getPort()).append("\r\n"); - buf.append(" ttl-").append(nodeInstace.getTtl()).append("\r\n"); - buf.append(" Created_at-").append(nodeInstace.getCreated_at()).append("\r\n"); - buf.append(" Updated_at-").append(nodeInstace.getUpdated_at()).append("\r\n"); - buf.append(" Expiration-").append(nodeInstace.getExpiration()).append("\r\n"); - } - buf.append("metadata:").append("\r\n"); + for (NodeInfo nodeInstace : this.getNodes()) { + buf.append(" nodeId-").append(nodeInstace.getNodeId()).append("\r\n"); + buf.append(" ip-").append(nodeInstace.getIp()).append("\r\n"); + buf.append(" port-").append(nodeInstace.getPort()).append("\r\n"); + buf.append(" ttl-").append(nodeInstace.getTtl()).append("\r\n"); + buf.append(" Created_at-").append(nodeInstace.getCreated_at()).append("\r\n"); + buf.append(" Updated_at-").append(nodeInstace.getUpdated_at()).append("\r\n"); + buf.append(" Expiration-").append(nodeInstace.getExpiration()).append("\r\n"); + } + buf.append("metadata:").append("\r\n"); - if (this.getMetadata() != null && this.getMetadata().size() > 0) { - for (KeyVaulePair keyVaulePair : this.getMetadata()) { - buf.append(" key-").append(keyVaulePair.getKey()).append("\r"); - buf.append(" value-").append(keyVaulePair.getValue()).append("\r\n"); + if (this.getMetadata() != null && this.getMetadata().size() > 0) { + for (KeyVaulePair keyVaulePair : this.getMetadata()) { + buf.append(" key-").append(keyVaulePair.getKey()).append("\r"); + buf.append(" value-").append(keyVaulePair.getValue()).append("\r\n"); - } + } + } + return buf.toString(); } - return buf.toString(); - } } diff --git a/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceInfo.java b/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceInfo.java index 00ffe81..5b44369 100644 --- a/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceInfo.java +++ b/src/main/java/org/onap/msb/sdk/discovery/entity/MicroServiceInfo.java @@ -23,33 +23,23 @@ import java.util.Set; * @date 2016-1-19 */ public class MicroServiceInfo extends Service implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - private Set nodes; + public String toString() { + StringBuffer buf = new StringBuffer(); + buf.append("MicroService List:").append("\r\n");; + buf.append("serviceName:").append(getServiceName()).append("\r\n"); + buf.append("version:").append(getVersion()).append("\r\n"); + buf.append("url:").append(getUrl()).append("\r\n"); + buf.append("protocol:").append(getProtocol()).append("\r\n"); + buf.append("visualRange:").append(getVisualRange()).append("\r\n"); + buf.append("nodes:").append("\r\n"); - public Set getNodes() { - return nodes; - } - - public void setNodes(Set nodes) { - this.nodes = nodes; - } - - public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append("MicroService List:").append("\r\n");; - buf.append("serviceName:").append(getServiceName()).append("\r\n"); - buf.append("version:").append(getVersion()).append("\r\n"); - buf.append("url:").append(getUrl()).append("\r\n"); - buf.append("protocol:").append(getProtocol()).append("\r\n"); - buf.append("visualRange:").append(getVisualRange()).append("\r\n"); - buf.append("nodes:").append("\r\n"); - - for (Node nodeInstace : this.nodes) { - buf.append(" ip-").append(nodeInstace.getIp()).append("\r\n"); - buf.append(" port-").append(nodeInstace.getPort()).append("\r\n"); - buf.append(" ttl-").append(nodeInstace.getTtl()).append("\r\n"); + for (Node nodeInstace : this.getNodes()) { + buf.append(" ip-").append(nodeInstace.getIp()).append("\r\n"); + buf.append(" port-").append(nodeInstace.getPort()).append("\r\n"); + buf.append(" ttl-").append(nodeInstace.getTtl()).append("\r\n"); + } + return buf.toString(); } - return buf.toString(); - } } -- cgit 1.2.3-korg