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=========================================================
20 package org.onap.so.db.catalog.beans;
23 import java.io.Serializable;
24 import java.util.Date;
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.FetchType;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.MapKey;
34 import javax.persistence.OneToMany;
35 import javax.persistence.Table;
36 import javax.persistence.Temporal;
37 import javax.persistence.TemporalType;
38 import org.apache.commons.lang3.builder.EqualsBuilder;
39 import org.apache.commons.lang3.builder.HashCodeBuilder;
40 import org.apache.commons.lang3.builder.ToStringBuilder;
41 import com.openpojo.business.annotation.BusinessKey;
44 @Table(name = "model")
45 public class Model implements Serializable {
47 private static final long serialVersionUID = 768026109321305392L;
50 @Column(name = "ID", nullable = false, updatable = false)
51 @GeneratedValue(strategy = GenerationType.IDENTITY)
53 @Column(name = "MODEL_CUSTOMIZATION_ID", length = 40)
54 private String modelCustomizationId = null;
55 @Column(name = "MODEL_CUSTOMIZATION_NAME", length = 40)
56 private String modelCustomizationName = null;
57 @Column(name = "MODEL_INVARIANT_ID", length = 40)
58 private String modelInvariantId = null;
59 @Column(name = "MODEL_NAME", length = 40)
60 private String modelName = null;
62 @Column(name = "MODEL_TYPE", length = 20)
63 private String modelType = null;
64 @Column(name = "MODEL_VERSION", length = 20)
65 private String modelVersion = null;
67 @Column(name = "MODEL_VERSION_ID", length = 40)
68 private String modelVersionId = null;
69 @Column(name = "CREATION_TIMESTAMP", nullable = false, updatable = false)
70 @Temporal(TemporalType.TIMESTAMP)
71 private Date created = null;
72 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "modelId")
73 @MapKey(name = "action")
74 private Map<String, ModelRecipe> recipes;
79 public Integer getId() {
84 * @return the modelCustomizationId
86 public String getModelCustomizationId() {
87 return modelCustomizationId;
91 * @param modelCustomizationId the modelCustomizationId to set
93 public void setModelCustomizationId(String modelCustomizationId) {
94 this.modelCustomizationId = modelCustomizationId;
98 * @return the modelCustomizationName
100 public String getModelCustomizationName() {
101 return modelCustomizationName;
105 * @param modelCustomizationName the modelCustomizationName to set
107 public void setModelCustomizationName(String modelCustomizationName) {
108 this.modelCustomizationName = modelCustomizationName;
112 * @return the modelInvariantId
114 public String getModelInvariantId() {
115 return modelInvariantId;
119 * @param modelInvariantId the modelInvariantId to set
121 public void setModelInvariantId(String modelInvariantId) {
122 this.modelInvariantId = modelInvariantId;
126 * @return the modelName
128 public String getModelName() {
133 * @param modelName the modelName to set
135 public void setModelName(String modelName) {
136 this.modelName = modelName;
140 * @return the modelType
142 public String getModelType() {
147 * @param modelType the modelType to set
149 public void setModelType(String modelType) {
150 this.modelType = modelType;
154 * @return the modelVersion
156 public String getModelVersion() {
161 * @param modelVersion the modelVersion to set
163 public void setModelVersion(String modelVersion) {
164 this.modelVersion = modelVersion;
168 * @return the modelVersionId
170 public String getModelVersionId() {
171 return modelVersionId;
175 * @param modelVersionId the modelVersionId to set
177 public void setModelVersionId(String modelVersionId) {
178 this.modelVersionId = modelVersionId;
182 * @return the created
184 public Date getCreated() {
189 * @return the recipes
191 public Map<String, ModelRecipe> getRecipes() {
196 * @param recipes the recipes to set
198 public void setRecipes(Map<String, ModelRecipe> recipes) {
199 this.recipes = recipes;
203 public boolean equals(final Object other) {
204 if (!(other instanceof Model)) {
207 Model castOther = (Model) other;
208 return new EqualsBuilder().append(getModelType(), castOther.getModelType())
209 .append(getModelVersionId(), castOther.getModelVersionId()).isEquals();
213 public int hashCode() {
214 return new HashCodeBuilder().append(getModelType()).append(getModelVersionId()).toHashCode();
218 public String toString() {
219 return new ToStringBuilder(this).append("id", getId()).append("modelCustomizationId", getModelCustomizationId())
220 .append("modelCustomizationName", getModelCustomizationName())
221 .append("modelInvariantId", getModelInvariantId()).append("modelName", getModelName())
222 .append("modelType", getModelType()).append("modelVersion", getModelVersion())
223 .append("modelVersionId", getModelVersionId()).append("created", getCreated())
224 .append("recipes", getRecipes()).toString();