Added UniversalVesAdapter in the Mapper
[dcaegen2/services/mapper.git] / UniversalVesAdapter / src / main / java / org / onap / universalvesadapter / mappingconfig / Evaluation.java
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : DCAE
4 * ================================================================================
5 * Copyright 2018 TechMahindra
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 package org.onap.universalvesadapter.mappingconfig;
21
22 import java.util.HashMap;
23 import java.util.Map;
24 import org.apache.commons.lang.builder.ToStringBuilder;
25 import com.fasterxml.jackson.annotation.JsonAnyGetter;
26 import com.fasterxml.jackson.annotation.JsonAnySetter;
27 import com.fasterxml.jackson.annotation.JsonIgnore;
28 import com.fasterxml.jackson.annotation.JsonInclude;
29 import com.fasterxml.jackson.annotation.JsonProperty;
30 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
31
32 @JsonInclude(JsonInclude.Include.NON_NULL)
33 @JsonPropertyOrder({
34     "operand",
35     "field",
36     "value",
37     "datatype",
38     "lhs",
39     "rhs"
40 })
41 public class Evaluation {
42
43
44         @JsonProperty("operand")
45     private String operand;
46     @JsonProperty("field")
47     private String field;
48     @JsonProperty("value")
49     private String value;
50     @JsonProperty("datatype")
51     private String datatype;
52     @JsonProperty("lhs")
53     private Evaluation lhs;
54     @JsonProperty("rhs")
55     private Evaluation rhs;
56     @JsonIgnore
57     private Map<String, Object> additionalProperties = new HashMap<String, Object>();
58
59     @JsonProperty("operand")
60     public String getOperand() {
61         return operand;
62     }
63
64     @JsonProperty("operand")
65     public void setOperand(String operand) {
66         this.operand = operand;
67     }
68
69     @JsonProperty("field")
70     public String getField() {
71         return field;
72     }
73
74     @JsonProperty("field")
75     public void setField(String field) {
76         this.field = field;
77     }
78
79     @JsonProperty("value")
80     public String getValue() {
81         return value;
82     }
83
84     @JsonProperty("value")
85     public void setValue(String value) {
86         this.value = value;
87     }
88
89     @JsonProperty("datatype")
90     public String getDatatype() {
91         return datatype;
92     }
93
94     @JsonProperty("datatype")
95     public void setDatatype(String datatype) {
96         this.datatype = datatype;
97     }
98
99     @JsonProperty("lhs")
100     public Evaluation getLhs() {
101         return lhs;
102     }
103
104     @JsonProperty("lhs")
105     public void setLhs(Evaluation lhs) {
106         this.lhs = lhs;
107     }
108
109     @JsonProperty("rhs")
110     public Evaluation getRhs() {
111         return rhs;
112     }
113
114     @JsonProperty("rhs")
115     public void setRhs(Evaluation rhs) {
116         this.rhs = rhs;
117     }
118
119     @JsonAnyGetter
120     public Map<String, Object> getAdditionalProperties() {
121         return this.additionalProperties;
122     }
123
124     @JsonAnySetter
125     public void setAdditionalProperty(String name, Object value) {
126         this.additionalProperties.put(name, value);
127     }
128
129     @Override
130     public String toString() {
131         return new ToStringBuilder(this).append("operand", operand).append("field", field).append("value", value).append("datatype", datatype).append("lhs", lhs).append("rhs", rhs).append("additionalProperties", additionalProperties).toString();
132     }
133     /* 
134     @Override
135     public int hashCode() {
136         return new HashCodeBuilder().append(field).append(additionalProperties).append(value).append(rhs).append(datatype).append(operand).append(lhs).toHashCode();
137     }
138
139    @Override
140     public boolean equals(Object other) {
141         if (other == this) {
142             return true;
143         }
144         if ((other instanceof Evaluation) == false) {
145             return false;
146         }
147         Evaluation rhs = ((Evaluation) other);
148         return new EqualsBuilder().append(field, rhs.field).append(additionalProperties, rhs.additionalProperties).append(value, rhs.value).append(rhs, rhs.rhs).append(datatype, rhs.datatype).append(operand, rhs.operand).append(lhs, rhs.lhs).isEquals();
149     }
150 */
151     
152     @Override
153         public int hashCode() {
154                 final int prime = 31;
155                 int result = 1;
156                 result = prime * result + ((datatype == null) ? 0 : datatype.hashCode());
157                 result = prime * result + ((field == null) ? 0 : field.hashCode());
158                 result = prime * result + ((lhs == null) ? 0 : lhs.hashCode());
159                 result = prime * result + ((operand == null) ? 0 : operand.hashCode());
160                 result = prime * result + ((rhs == null) ? 0 : rhs.hashCode());
161                 result = prime * result + ((value == null) ? 0 : value.hashCode());
162                 return result;
163         }
164
165         @Override
166         public boolean equals(Object obj) {
167                 if (this == obj)
168                         return true;
169                 if (obj == null)
170                         return false;
171                 if (getClass() != obj.getClass())
172                         return false;
173                 Evaluation other = (Evaluation) obj;
174                 if (datatype == null) {
175                         if (other.datatype != null)
176                                 return false;
177                 } else if (!datatype.equals(other.datatype))
178                         return false;
179                 if (field == null) {
180                         if (other.field != null)
181                                 return false;
182                 } else if (!field.equals(other.field))
183                         return false;
184                 if (lhs == null) {
185                         if (other.lhs != null)
186                                 return false;
187                 } else if (!lhs.equals(other.lhs))
188                         return false;
189                 if (operand == null) {
190                         if (other.operand != null)
191                                 return false;
192                 } else if (!operand.equals(other.operand))
193                         return false;
194                 if (rhs == null) {
195                         if (other.rhs != null)
196                                 return false;
197                 } else if (!rhs.equals(other.rhs))
198                         return false;
199                 if (value == null) {
200                         if (other.value != null)
201                                 return false;
202                 } else if (!value.equals(other.value))
203                         return false;
204                 return true;
205         }
206     
207     
208 }