3d7cb681723f7e647857da4543c3b9ad0261b6a5
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / ModelRecipe.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
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34
35 import org.apache.commons.lang3.builder.EqualsBuilder;
36 import org.apache.commons.lang3.builder.HashCodeBuilder;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
38
39 import com.openpojo.business.annotation.BusinessKey;
40
41 @Entity
42 @Table(name = "model_recipe")
43 public class ModelRecipe implements Serializable {
44         
45         private static final long serialVersionUID = 768026109321305392L;
46         
47         @Id
48         @Column(name = "ID", nullable = false, updatable = false)
49         @GeneratedValue(strategy = GenerationType.IDENTITY)
50         private Integer id;
51         @BusinessKey
52         @Column(name = "MODEL_ID", nullable = false)
53         private Integer modelId;
54         @BusinessKey
55         @Column(name = "ACTION", length = 50)
56         private String action = null;
57         @Column(name = "SCHEMA_VERSION", length = 20)
58         private String schemaVersion = null; 
59         @Column(name = "DESCRIPTION", length = 1200)
60         private String description = null;
61         @Column(name = "ORCHESTRATION_URI", length = 256)
62         private String orchestrationUri = null;
63         @Column(name = "MODEL_PARAM_XSD", length = 2048)
64         private String modelParamXSD = null;
65         @Column(name = "RECIPE_TIMEOUT")
66         private Integer recipeTimeout;
67         @Column(name = "CREATION_TIMESTAMP", nullable = false, updatable = false)
68         @Temporal(TemporalType.TIMESTAMP)
69         private Date created = null;
70
71         /**
72          * @return the id
73          */
74         public Integer getId() {
75                 return id;
76         }
77
78         /**
79          * @return the modelId
80          */
81         public Integer getModelId() {
82                 return modelId;
83         }
84
85         /**
86          * @param modelId the modelId to set
87          */
88         public void setModelId(Integer modelId) {
89                 this.modelId = modelId;
90         }
91
92         /**
93          * @return the action
94          */
95         public String getAction() {
96                 return action;
97         }
98
99         /**
100          * @param action the action to set
101          */
102         public void setAction(String action) {
103                 this.action = action;
104         }
105
106         /**
107          * @return the versionStr
108          */
109         public String getSchemaVersion() {
110                 return schemaVersion;
111         }
112
113         /**
114          * @param schemaVersion the versionStr to set
115          */
116         public void setSchemaVersion(String schemaVersion) {
117                 this.schemaVersion = schemaVersion;
118         }
119
120         /**
121          * @return the description
122          */
123         public String getDescription() {
124                 return description;
125         }
126
127         /**
128          * @param description the description to set
129          */
130         public void setDescription(String description) {
131                 this.description = description;
132         }
133
134         /**
135          * @return the orchestrationUri
136          */
137         public String getOrchestrationUri() {
138                 return orchestrationUri;
139         }
140
141         /**
142          * @param orchestrationUri the orchestrationUri to set
143          */
144         public void setOrchestrationUri(String orchestrationUri) {
145                 this.orchestrationUri = orchestrationUri;
146         }
147
148         /**
149          * @return the modelParamXSD
150          */
151         public String getModelParamXSD() {
152                 return modelParamXSD;
153         }
154
155         /**
156          * @param modelParamXSD the modelParamXSD to set
157          */
158         public void setModelParamXSD(String modelParamXSD) {
159                 this.modelParamXSD = modelParamXSD;
160         }
161
162         /**
163          * @return the recipeTimeout
164          */
165         public Integer getRecipeTimeout() {
166                 return recipeTimeout;
167         }
168
169         /**
170          * @param recipeTimeout the recipeTimeout to set
171          */
172         public void setRecipeTimeout(Integer recipeTimeout) {
173                 this.recipeTimeout = recipeTimeout;
174         }
175
176         /**
177          * @return the created
178          */
179         public Date getCreated() {
180                 return created;
181         }
182
183         @Override
184         public boolean equals(final Object other) {
185                 if (!(other instanceof ModelRecipe)) {
186                         return false;
187                 }
188                 ModelRecipe castOther = (ModelRecipe) other;
189                 return new EqualsBuilder().append(getModelId(), castOther.getModelId())
190                                 .append(getAction(), castOther.getAction()).isEquals();
191         }
192
193         @Override
194         public int hashCode() {
195                 return new HashCodeBuilder().append(getModelId()).append(getAction()).toHashCode();
196         }
197
198         @Override
199         public String toString() {
200                 return new ToStringBuilder(this).append("id", getId()).append("modelId", getModelId())
201                                 .append("action", getAction()).append("schemaVersion", getSchemaVersion())
202                                 .append("description", getDescription()).append("orchestrationUri", getOrchestrationUri())
203                                 .append("modelParamXSD", getModelParamXSD()).append("recipeTimeout", getRecipeTimeout())
204                                 .append("created", getCreated()).toString();
205         }
206 }