Initial OpenECOMP SDC commit
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / elements / PropertyDataDefinition.java
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.be.datatypes.elements;
22
23 import java.io.Serializable;
24
25 public class PropertyDataDefinition implements Serializable {
26
27         /**
28          * 
29          */
30         private static final long serialVersionUID = 5798685557528432389L;
31
32         private String uniqueId;
33
34         // "boolean", "string", "float", "integer", "version" })
35         private String type;
36
37         private Boolean required;
38
39         protected boolean definition = false;
40
41         private String defaultValue;
42
43         private String description;
44
45         private SchemaDefinition schema;
46
47         private boolean password;
48
49         public PropertyDataDefinition() {
50
51         }
52
53         public PropertyDataDefinition(PropertyDataDefinition p) {
54                 this.uniqueId = p.uniqueId;
55                 this.required = p.required;
56                 this.defaultValue = p.defaultValue;
57                 this.description = p.description;
58                 this.schema = p.schema;
59                 this.password = p.password;
60                 this.type = p.type;
61         }
62
63         // @Override
64         public boolean isDefinition() {
65                 return true;
66         }
67
68         public void setDefinition(boolean definition) {
69                 this.definition = definition;
70         }
71
72         public String getType() {
73                 return type;
74         }
75
76         public String getDefaultValue() {
77                 return defaultValue;
78         }
79
80         public void setDefaultValue(String defaultValue) {
81                 this.defaultValue = defaultValue;
82         }
83
84         public void setType(String type) {
85                 this.type = type;
86         }
87
88         public Boolean isRequired() {
89                 return required;
90         }
91
92         public void setRequired(Boolean required) {
93                 this.required = required;
94         }
95
96         public String getDescription() {
97                 return description;
98         }
99
100         public void setDescription(String description) {
101                 this.description = description;
102         }
103
104         public boolean isPassword() {
105                 return password;
106         }
107
108         public void setPassword(boolean password) {
109                 this.password = password;
110         }
111
112         public String getUniqueId() {
113                 return uniqueId;
114         }
115
116         public void setUniqueId(String uniqueId) {
117                 this.uniqueId = uniqueId;
118         }
119
120         public SchemaDefinition getSchema() {
121                 return schema;
122         }
123
124         public void setSchema(SchemaDefinition entrySchema) {
125                 this.schema = entrySchema;
126         }
127
128         @Override
129         public String toString() {
130                 return "PropertyDataDefinition [uniqueId=" + uniqueId + ", type=" + type + ", required=" + required
131                                 + ", defaultValue=" + defaultValue + ", description=" + description + ", entrySchema=" + schema
132                                 + ", password=" + password + "]";
133         }
134
135         @Override
136         public int hashCode() {
137                 final int prime = 31;
138                 int result = 1;
139                 result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode());
140                 result = prime * result + (definition ? 1231 : 1237);
141                 result = prime * result + ((description == null) ? 0 : description.hashCode());
142                 result = prime * result + (password ? 1231 : 1237);
143                 result = prime * result + ((required == null) ? 0 : required.hashCode());
144                 result = prime * result + ((schema == null) ? 0 : schema.hashCode());
145                 result = prime * result + ((type == null) ? 0 : type.hashCode());
146                 result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
147                 return result;
148         }
149
150         @Override
151         public boolean equals(Object obj) {
152                 if (this == obj)
153                         return true;
154                 if (obj == null)
155                         return false;
156                 if (getClass() != obj.getClass())
157                         return false;
158                 PropertyDataDefinition other = (PropertyDataDefinition) obj;
159                 if (defaultValue == null) {
160                         if (other.defaultValue != null)
161                                 return false;
162                 } else if (!defaultValue.equals(other.defaultValue))
163                         return false;
164                 if (definition != other.definition)
165                         return false;
166                 if (description == null) {
167                         if (other.description != null)
168                                 return false;
169                 } else if (!description.equals(other.description))
170                         return false;
171                 if (password != other.password)
172                         return false;
173                 if (required == null) {
174                         if (other.required != null)
175                                 return false;
176                 } else if (!required.equals(other.required))
177                         return false;
178                 if (schema == null) {
179                         if (other.schema != null)
180                                 return false;
181                 } else if (!schema.equals(other.schema))
182                         return false;
183                 if (type == null) {
184                         if (other.type != null)
185                                 return false;
186                 } else if (!type.equals(other.type))
187                         return false;
188                 if (uniqueId == null) {
189                         if (other.uniqueId != null)
190                                 return false;
191                 } else if (!uniqueId.equals(other.uniqueId))
192                         return false;
193                 return true;
194         }
195 }