Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / Model.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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 package org.onap.so.db.catalog.beans;
21
22
23 import java.io.Serializable;
24 import java.util.Date;
25 import java.util.Map;
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;
42
43 @Entity
44 @Table(name = "model")
45 public class Model implements Serializable {
46
47     private static final long serialVersionUID = 768026109321305392L;
48
49     @Id
50     @Column(name = "ID", nullable = false, updatable = false)
51     @GeneratedValue(strategy = GenerationType.IDENTITY)
52     private Integer id;
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;
61     @BusinessKey
62     @Column(name = "MODEL_TYPE", length = 20)
63     private String modelType = null;
64     @Column(name = "MODEL_VERSION", length = 20)
65     private String modelVersion = null;
66     @BusinessKey
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;
75
76     /**
77      * @return the id
78      */
79     public Integer getId() {
80         return id;
81     }
82
83     /**
84      * @return the modelCustomizationId
85      */
86     public String getModelCustomizationId() {
87         return modelCustomizationId;
88     }
89
90     /**
91      * @param modelCustomizationId the modelCustomizationId to set
92      */
93     public void setModelCustomizationId(String modelCustomizationId) {
94         this.modelCustomizationId = modelCustomizationId;
95     }
96
97     /**
98      * @return the modelCustomizationName
99      */
100     public String getModelCustomizationName() {
101         return modelCustomizationName;
102     }
103
104     /**
105      * @param modelCustomizationName the modelCustomizationName to set
106      */
107     public void setModelCustomizationName(String modelCustomizationName) {
108         this.modelCustomizationName = modelCustomizationName;
109     }
110
111     /**
112      * @return the modelInvariantId
113      */
114     public String getModelInvariantId() {
115         return modelInvariantId;
116     }
117
118     /**
119      * @param modelInvariantId the modelInvariantId to set
120      */
121     public void setModelInvariantId(String modelInvariantId) {
122         this.modelInvariantId = modelInvariantId;
123     }
124
125     /**
126      * @return the modelName
127      */
128     public String getModelName() {
129         return modelName;
130     }
131
132     /**
133      * @param modelName the modelName to set
134      */
135     public void setModelName(String modelName) {
136         this.modelName = modelName;
137     }
138
139     /**
140      * @return the modelType
141      */
142     public String getModelType() {
143         return modelType;
144     }
145
146     /**
147      * @param modelType the modelType to set
148      */
149     public void setModelType(String modelType) {
150         this.modelType = modelType;
151     }
152
153     /**
154      * @return the modelVersion
155      */
156     public String getModelVersion() {
157         return modelVersion;
158     }
159
160     /**
161      * @param modelVersion the modelVersion to set
162      */
163     public void setModelVersion(String modelVersion) {
164         this.modelVersion = modelVersion;
165     }
166
167     /**
168      * @return the modelVersionId
169      */
170     public String getModelVersionId() {
171         return modelVersionId;
172     }
173
174     /**
175      * @param modelVersionId the modelVersionId to set
176      */
177     public void setModelVersionId(String modelVersionId) {
178         this.modelVersionId = modelVersionId;
179     }
180
181     /**
182      * @return the created
183      */
184     public Date getCreated() {
185         return created;
186     }
187
188     /**
189      * @return the recipes
190      */
191     public Map<String, ModelRecipe> getRecipes() {
192         return recipes;
193     }
194
195     /**
196      * @param recipes the recipes to set
197      */
198     public void setRecipes(Map<String, ModelRecipe> recipes) {
199         this.recipes = recipes;
200     }
201
202     @Override
203     public boolean equals(final Object other) {
204         if (!(other instanceof Model)) {
205             return false;
206         }
207         Model castOther = (Model) other;
208         return new EqualsBuilder().append(getModelType(), castOther.getModelType())
209                 .append(getModelVersionId(), castOther.getModelVersionId()).isEquals();
210     }
211
212     @Override
213     public int hashCode() {
214         return new HashCodeBuilder().append(getModelType()).append(getModelVersionId()).toHashCode();
215     }
216
217     @Override
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();
225     }
226
227 }