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