Change comments to English
[msb/java-sdk.git] / src / main / java / org / onap / msb / sdk / discovery / entity / MicroServiceFullInfo.java
1 /*******************************************************************************
2  * Copyright 2017 ZTE, Inc. and others.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  * 
7  * http://www.apache.org/licenses/LICENSE-2.0
8  * 
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  ******************************************************************************/
14 package org.onap.msb.sdk.discovery.entity;
15
16 import java.io.Serializable;
17 import java.util.Set;
18
19 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
20
21 @JsonIgnoreProperties(ignoreUnknown = true)
22 public class MicroServiceFullInfo extends Service<NodeInfo> implements Serializable {
23   private static final long serialVersionUID = 1L;
24
25   private Set<NodeInfo> nodes;
26
27   //Reserved
28   private String status = "1";
29
30   public Set<NodeInfo> getNodes() {
31     return nodes;
32   }
33
34   public void setNodes(Set<NodeInfo> nodes) {
35     this.nodes = nodes;
36   }
37
38   public String getStatus() {
39     return status;
40   }
41
42   public void setStatus(String status) {
43     this.status = status;
44   }
45
46
47   public String toString() {
48     StringBuffer buf = new StringBuffer();
49     buf.append("MicroService List:").append("\r\n");;
50     buf.append("serviceName:").append(getServiceName()).append("\r\n");
51     buf.append("version:").append(getVersion()).append("\r\n");
52     buf.append("url:").append(getUrl()).append("\r\n");
53     buf.append("protocol:").append(getProtocol()).append("\r\n");
54     buf.append("visualRange:").append(getVisualRange()).append("\r\n");
55     buf.append("nodes:").append("\r\n");
56
57     for (NodeInfo nodeInstace : this.nodes) {
58       buf.append("  nodeId-").append(nodeInstace.getNodeId()).append("\r\n");
59       buf.append("  ip-").append(nodeInstace.getIp()).append("\r\n");
60       buf.append("  port-").append(nodeInstace.getPort()).append("\r\n");
61       buf.append("  ttl-").append(nodeInstace.getTtl()).append("\r\n");
62       buf.append("  Created_at-").append(nodeInstace.getCreated_at()).append("\r\n");
63       buf.append("  Updated_at-").append(nodeInstace.getUpdated_at()).append("\r\n");
64       buf.append("  Expiration-").append(nodeInstace.getExpiration()).append("\r\n");
65     }
66     buf.append("metadata:").append("\r\n");
67
68     if (this.getMetadata() != null && this.getMetadata().size() > 0) {
69       for (KeyVaulePair keyVaulePair : this.getMetadata()) {
70         buf.append("  key-").append(keyVaulePair.getKey()).append("\r");
71         buf.append("  value-").append(keyVaulePair.getValue()).append("\r\n");
72
73       }
74     }
75     return buf.toString();
76   }
77
78 }