3f0bac06d43e6c679f0f47a1c80dc0fcb7c699ce
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.openecomp.sdc.ci.tests.tosca.datatypes;
22
23 import com.google.gson.annotations.SerializedName;
24 import org.yaml.snakeyaml.TypeDescription;
25
26 import java.util.ArrayList;
27 import java.util.List;
28 import java.util.Map;
29
30 public class ToscaInputsTopologyTemplateDefinition {
31         
32         public String name;
33         public String type;
34         public String description;
35         public Boolean required;
36         public Boolean hidden;
37         public Boolean immutable;
38         @SerializedName("default")
39         public Object Default;
40
41         public String status;
42         public List<Object> constraints = new ArrayList<>();
43         public Map<String, Object> entry_schema;
44         public Object value;
45         public Map<String, ToscaInputsAnnotation> annotations;
46
47         public ToscaInputsTopologyTemplateDefinition(String name, String type, String description, Boolean required, Object default1, String status, List<Object> constraints, Map<String, Object> entry_schema, Object value, Boolean immutable, Boolean hidden, Map<String, ToscaInputsAnnotation> annotations) {
48                 super();
49                 this.name = name;
50                 this.type = type;
51                 this.description = description;
52                 this.required = required;
53                 Default = default1;
54                 this.status = status;
55                 this.constraints = constraints;
56                 this.entry_schema = entry_schema;
57                 this.value = value;
58                 this.immutable = immutable;
59                 this.hidden = hidden;
60                 this.annotations = annotations;
61         }
62
63         public ToscaInputsTopologyTemplateDefinition() {
64         }
65         public ToscaInputsTopologyTemplateDefinition(ToscaInputsTopologyTemplateDefinition definition){
66 //              this(definition.getName(), definition.getType(), definition.getDescription(), definition.getRequired(), definition.getDefault(), definition.getStatus(), definition.getConstraints(), definition.getEntry_schema(), definition.getValue());
67                 this.name = definition.name;
68                 this.type = definition.type;
69                 this.description = definition.description;
70                 this.required = definition.required;
71                 this.Default = definition.Default;
72                 this.status = definition.status;
73                 this.constraints = definition.constraints;
74                 this.entry_schema = definition.entry_schema;
75                 this.value = definition.value;
76                 this.immutable = immutable;
77                 this.hidden = hidden;
78         }
79         
80         public Boolean getHidden() {
81                 return hidden;
82         }
83
84         public void setHidden(Boolean hidden) {
85                 this.hidden = hidden;
86         }
87
88         public Boolean getImmutable() {
89                 return immutable;
90         }
91
92         public void setImmutable(Boolean immutable) {
93                 this.immutable = immutable;
94         }
95
96         public String getName() {
97                 return name;
98         }
99
100         public void setName(String name) {
101                 this.name = name;
102         }
103
104         public String getType() {
105                 return type;
106         }
107
108         public void setType(String type) {
109                 this.type = type;
110         }
111
112         public String getDescription() {
113                 return description;
114         }
115
116         public void setDescription(String description) {
117                 this.description = description;
118         }
119
120         public Boolean getRequired() {
121                 return required;
122         }
123
124         public void setRequired(Boolean required) {
125                 this.required = required;
126         }
127
128         public Object getDefault() {
129                 return Default;
130         }
131
132         public void setDefault(Object default1) {
133                 Default = default1;
134         }
135
136         public String getStatus() {
137                 return status;
138         }
139
140         public void setStatus(String status) {
141                 this.status = status;
142         }
143
144         public List<Object> getConstraints() {
145                 return constraints;
146         }
147
148         public void setConstraints(List<Object> constraints) {
149                 this.constraints = constraints;
150         }
151
152         public Map<String, Object> getEntry_schema() {
153                 return entry_schema;
154         }
155
156         public void setEntry_schema(Map<String, Object> entry_schema) {
157                 this.entry_schema = entry_schema;
158         }
159
160         public Object getValue() {
161                 return value;
162         }
163
164         public void setValue(Object value) {
165                 this.value = value;
166         }
167
168         public Map<String, ToscaInputsAnnotation> getAnnotations() {
169                 return annotations;
170         }
171
172         public void setAnnotations(Map<String, ToscaInputsAnnotation> annotations) {
173                 this.annotations = annotations;
174         }
175
176         //gets Type description for Yaml snake
177         public static TypeDescription getTypeDescription(){
178         TypeDescription typeDescription = new TypeDescription(ToscaInputsTopologyTemplateDefinition.class);
179         typeDescription.putListPropertyType("constraints", Object.class);
180         typeDescription.putMapPropertyType("entry_schema", String.class, Object.class);
181         typeDescription.putMapPropertyType("annotations", String.class, ToscaInputsAnnotation.class); 
182         return typeDescription;
183         }
184
185         @Override
186         public int hashCode() {
187                 final int prime = 31;
188                 int result = 1;
189                 result = prime * result + ((Default == null) ? 0 : Default.hashCode());
190                 result = prime * result + ((constraints == null) ? 0 : constraints.hashCode());
191                 result = prime * result + ((description == null) ? 0 : description.hashCode());
192                 result = prime * result + ((entry_schema == null) ? 0 : entry_schema.hashCode());
193                 result = prime * result + ((hidden == null) ? 0 : hidden.hashCode());
194                 result = prime * result + ((immutable == null) ? 0 : immutable.hashCode());
195                 result = prime * result + ((name == null) ? 0 : name.hashCode());
196                 result = prime * result + ((required == null) ? 0 : required.hashCode());
197                 result = prime * result + ((status == null) ? 0 : status.hashCode());
198                 result = prime * result + ((type == null) ? 0 : type.hashCode());
199                 result = prime * result + ((value == null) ? 0 : value.hashCode());
200                 return result;
201         }
202
203         @Override
204         public boolean equals(Object obj) {
205                 if (this == obj)
206                         return true;
207                 if (obj == null)
208                         return false;
209                 if (getClass() != obj.getClass())
210                         return false;
211                 ToscaInputsTopologyTemplateDefinition other = (ToscaInputsTopologyTemplateDefinition) obj;
212                 if (Default == null) {
213                         if (other.Default != null)
214                                 return false;
215                 } else if (!Default.equals(other.Default))
216                         return false;
217                 if (constraints == null) {
218                         if (other.constraints != null)
219                                 return false;
220                 } else if (!constraints.equals(other.constraints))
221                         return false;
222                 if (description == null) {
223                         if (other.description != null)
224                                 return false;
225                 } else if (!description.equals(other.description))
226                         return false;
227                 if (entry_schema == null) {
228                         if (other.entry_schema != null)
229                                 return false;
230                 } else if (!entry_schema.equals(other.entry_schema))
231                         return false;
232                 if (hidden == null) {
233                         if (other.hidden != null)
234                                 return false;
235                 } else if (!hidden.equals(other.hidden))
236                         return false;
237                 if (immutable == null) {
238                         if (other.immutable != null)
239                                 return false;
240                 } else if (!immutable.equals(other.immutable))
241                         return false;
242                 if (name == null) {
243                         if (other.name != null)
244                                 return false;
245                 } else if (!name.equals(other.name))
246                         return false;
247                 if (required == null) {
248                         if (other.required != null)
249                                 return false;
250                 } else if (!required.equals(other.required))
251                         return false;
252                 if (status == null) {
253                         if (other.status != null)
254                                 return false;
255                 } else if (!status.equals(other.status))
256                         return false;
257                 if (type == null) {
258                         if (other.type != null)
259                                 return false;
260                 } else if (!type.equals(other.type))
261                         return false;
262                 if (value == null) {
263                         if (other.value != null)
264                                 return false;
265                 } else if (!value.equals(other.value))
266                         return false;
267                 return true;
268         }
269
270 }