2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
24 package org.onap.clamp.tosca;
26 import com.google.gson.annotations.Expose;
28 import java.io.Serializable;
30 import javax.persistence.CascadeType;
31 import javax.persistence.Column;
32 import javax.persistence.Entity;
33 import javax.persistence.Id;
34 import javax.persistence.JoinColumn;
35 import javax.persistence.ManyToOne;
36 import javax.persistence.Table;
38 import org.onap.clamp.loop.common.AuditEntity;
41 * Represents a Dictionary Item.
44 @Table(name = "dictionary_elements")
45 public class DictionaryElement extends AuditEntity implements Serializable {
48 * The serial version id.
50 private static final long serialVersionUID = -286522707701388644L;
54 @Column(nullable = false, name = "name", unique = true)
58 @Column(nullable = false, name = "short_name", unique = true)
59 private String shortName;
62 @Column(name = "description")
63 private String description;
66 @Column(nullable = false, name = "type")
69 @Column(name = "subdictionary_id", nullable = false)
71 private String subDictionary;
73 @ManyToOne(cascade = CascadeType.ALL)
74 @JoinColumn(name = "dictionary_id")
75 private Dictionary dictionary;
82 public String getName() {
89 * @param name the name to set
91 public void setName(String name) {
98 * @return the shortName
100 public String getShortName() {
107 * @param shortName the shortName to set
109 public void setShortName(String shortName) {
110 this.shortName = shortName;
114 * description getter.
116 * @return the description
118 public String getDescription() {
123 * description setter.
125 * @param description the description to set
127 public void setDescription(String description) {
128 this.description = description;
136 public String getType() {
143 * @param type the type to set
145 public void setType(String type) {
150 * subDictionary getter.
152 * @return the subDictionary
154 public String getSubDictionary() {
155 return subDictionary;
159 * subDictionary setter.
161 * @param subDictionary the subDictionary to set
163 public void setSubDictionary(String subDictionary) {
164 this.subDictionary = subDictionary;
170 * @return the dictionary
172 public Dictionary getDictionary() {
179 * @param dictionary the dictionary to set
181 public void setDictionary(Dictionary dictionary) {
182 this.dictionary = dictionary;
186 * Default Constructor.
188 public DictionaryElement() {
194 * @param name The Dictionary element name
195 * @param shortName The short name
196 * @param description The description
197 * @param type The type of element
198 * @param subDictionary The sub type
199 * @param dictionary The parent dictionary
201 public DictionaryElement(String name, String shortName, String description, String type, String subDictionary,
202 Dictionary dictionary) {
204 this.shortName = shortName;
205 this.description = description;
207 this.subDictionary = subDictionary;
208 this.dictionary = dictionary;
212 public int hashCode() {
213 final int prime = 31;
215 result = prime * result + ((dictionary == null) ? 0 : dictionary.hashCode());
216 result = prime * result + ((name == null) ? 0 : name.hashCode());
221 public boolean equals(Object obj) {
228 if (getClass() != obj.getClass()) {
231 DictionaryElement other = (DictionaryElement) obj;
232 if (dictionary == null) {
233 if (other.dictionary != null) {
236 } else if (!dictionary.equals(other.dictionary)) {
240 if (other.name != null) {
243 } else if (!name.equals(other.name)) {