modify copyright year
[msb/discovery.git] / sdclient / discovery-service / src / main / java / org / onap / msb / sdclient / core / NodeInfo.java
1 /**
2  * Copyright 2016-2017 ZTE, Inc. and others.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onap.msb.sdclient.core;
17
18 import java.util.Date;
19
20 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
21 import com.google.common.base.Objects;
22
23 public class NodeInfo extends Node {
24
25     private static final long serialVersionUID = 8955786461351557306L;
26     
27     private String nodeId; //node唯一标识
28     
29     private String status; //实例健康检查状态
30     
31   
32     @JsonSerialize(using = CustomDateSerializer.class)
33     private Date expiration;
34     
35     @JsonSerialize(using = CustomDateSerializer.class)
36     private Date created_at;
37     
38     @JsonSerialize(using = CustomDateSerializer.class)
39     private Date updated_at;
40     
41
42
43     public Date getExpiration() {
44         return expiration;
45     }
46
47     public void setExpiration(Date expiration) {
48         this.expiration = expiration;
49     }
50
51     public Date getCreated_at() {
52         return created_at;
53     }
54
55     public void setCreated_at(Date created_at) {
56         this.created_at = created_at;
57     }
58
59     public Date getUpdated_at() {
60         return updated_at;
61     }
62
63     public void setUpdated_at(Date updated_at) {
64         this.updated_at = updated_at;
65     }
66
67     public String getNodeId() {
68         return nodeId;
69     }
70
71     public void setNodeId(String nodeId) {
72         this.nodeId = nodeId;
73     }
74
75     public String getStatus() {
76         return status;
77     }
78
79     public void setStatus(String status) {
80         this.status = status;
81     }
82     
83     @Override
84     public int hashCode() {
85         return Objects.hashCode(getIp(),getPort(),getHa_role(),status );
86     }
87     
88     @Override
89     public boolean equals(Object other)
90     {
91         if(this == other)
92             return true;
93         if(other instanceof NodeInfo)
94         {
95           NodeInfo that = (NodeInfo)other;
96             return Objects.equal(getIp(), that.getIp()) 
97                    && Objects.equal(getPort(), that.getPort());
98         } else
99         {
100             return false;
101         }
102     }
103
104   
105     
106 }