2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.datatypes.elements;
23 import java.io.Serializable;
24 import java.util.Objects;
26 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
27 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
30 * Represents AttributeDataDefinition
35 public class AttributeDataDefinition extends ToscaDataDefinition implements Serializable {
40 private static final long serialVersionUID = -3046831950009259569L;
42 private String uniqueId;
45 private String description;
47 private String defaultValue;
50 private String status;
51 private SchemaDefinition schema;
53 public AttributeDataDefinition() {
54 // Used From Attribute Defenition
62 public AttributeDataDefinition(AttributeDataDefinition attribute) {
63 this.uniqueId = attribute.uniqueId;
64 this.name = attribute.name;
65 this.type = attribute.type;
66 this.description = attribute.description;
67 this.defaultValue = attribute.defaultValue;
68 this.value = attribute.value;
69 this.status = attribute.status;
70 this.schema = attribute.schema;
73 public String getUniqueId() {
77 public void setUniqueId(String uniqueId) {
78 this.uniqueId = uniqueId;
81 public String getName() {
85 public void setName(String name) {
89 public String getType() {
93 public void setType(String type) {
97 public String getDescription() {
101 public void setDescription(String description) {
102 this.description = description;
105 public String getDefaultValue() {
109 public void setDefaultValue(String defaultValue) {
110 this.defaultValue = defaultValue;
113 public String getStatus() {
117 public void setStatus(String status) {
118 this.status = status;
121 public SchemaDefinition getSchema() {
125 public void setSchema(SchemaDefinition entrySchema) {
126 this.schema = entrySchema;
130 public int hashCode() {
131 final int prime = 31;
133 result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode());
134 result = prime * result + ((value == null) ? 0 : value.hashCode());
135 result = prime * result + ((description == null) ? 0 : description.hashCode());
136 result = prime * result + ((name == null) ? 0 : name.hashCode());
137 result = prime * result + ((type == null) ? 0 : type.hashCode());
138 result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
139 result = prime * result + ((status == null) ? 0 : status.hashCode());
140 result = prime * result + ((schema == null) ? 0 : schema.hashCode());
145 public boolean equals(Object obj) {
146 boolean equals = true;
150 if (obj == null || getClass() != obj.getClass()) {
154 AttributeDataDefinition other = (AttributeDataDefinition) obj;
155 if (!Objects.equals(defaultValue, other.defaultValue)) {
157 } else if (!Objects.equals(value, other.value)) {
159 } else if (!Objects.equals(description, other.description)) {
161 } else if (!Objects.equals(name, other.name)) {
163 } else if (!Objects.equals(type, other.type)) {
165 } else if (!Objects.equals(uniqueId, other.uniqueId)) {
167 } else if (!Objects.equals(status, other.status)) {
169 } else if (!Objects.equals(schema, other.schema)) {
176 public String toString() {
177 return "AttributeDataDefinition [uniqueId=" + uniqueId + ", name=" + name + ", type=" + type + ", description="
178 + description + ", defaultValue=" + defaultValue + ", value=" + value + ", status=" + status
179 + ", entrySchema=" + schema + "]";
182 public String getValue() {
186 public void setValue(String value) {
191 public Object getToscaPresentationValue(JsonPresentationFields field) {
206 return super.getToscaPresentationValue(field);