No topic dups in mmagent whitelist
[dmaap/dbcapi.git] / src / main / java / org / onap / dmaap / dbcapi / model / ReplicationVector.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * org.onap.dmaap
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.dmaap.dbcapi.model;
22
23 public class ReplicationVector {
24         
25         public enum ReplicationVector_Status {
26                 EMPTY,
27                 NEW,
28                 STAGED,
29                 VALID,
30                 INVALID,
31                 INVALID_DUP,
32                 DELETED
33         }
34
35         String  fqtn;
36         String  sourceCluster;
37         String  targetCluster;
38         ReplicationVector_Status status;
39         
40         public ReplicationVector(){
41                 
42         }
43         
44         public ReplicationVector(String fqtn, String sourceCluster,
45                         String targetCluster) {
46                 super();
47                 this.fqtn = fqtn;
48                 this.sourceCluster = sourceCluster;
49                 this.targetCluster = targetCluster;
50         }
51
52         public String getFqtn() {
53                 return fqtn;
54         }
55
56         public void setFqtn(String fqtn) {
57                 this.fqtn = fqtn;
58         }
59
60         public String getSourceCluster() {
61                 return sourceCluster;
62         }
63
64         public void setSourceCluster(String sourceCluster) {
65                 this.sourceCluster = sourceCluster;
66         }
67
68         public String getTargetCluster() {
69                 return targetCluster;
70         }
71
72         public void setTargetCluster(String targetCluster) {
73                 this.targetCluster = targetCluster;
74         }
75         
76         public int hashCode() {
77                 StringBuilder tmp = new StringBuilder( this.fqtn );
78                 tmp.append(this.sourceCluster);
79                 tmp.append(this.targetCluster);
80                 
81                 return tmp.toString().hashCode();
82         }
83         private static boolean xeq(String s1, String s2) {
84                 if (s1 == null) {
85                         return(s2 == null);
86                 } else {
87                         return(s1.equals(s2));
88                 }
89         }
90         public boolean equals(Object o) {
91                 if (o == this) {
92                         return(true);
93                 }
94                 if (!(o instanceof ReplicationVector)) {
95                         return(false);
96                 }
97                 ReplicationVector x = (ReplicationVector)o;
98                 return(xeq(fqtn, x.fqtn) && xeq(sourceCluster, x.sourceCluster) && xeq(targetCluster, x.targetCluster));
99         }
100 }