Containerization feature of SO
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / ArRecipe.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
21 package org.onap.so.db.catalog.beans;
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.Id;
29 import javax.persistence.Table;
30 import javax.persistence.Temporal;
31 import javax.persistence.TemporalType;
32
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
37 import com.openpojo.business.annotation.BusinessKey;
38
39 @Entity
40 @Table(name = "ar_recipe")
41 public class ArRecipe implements Recipe, Serializable {
42         private static final long serialVersionUID = 768026109321305392L;
43
44         @Id
45         @Column(name = "ID", nullable = false)
46         private Integer id;
47         @BusinessKey
48         @Column(name = "MODEL_NAME", nullable = false)
49         private String modelName;
50         @BusinessKey
51         @Column(name = "ACTION", nullable = false)
52         private String action;
53
54         @Column(name = "VERSION_STR", nullable = false)
55         private String version;
56         @BusinessKey
57         @Column(name = "SERVICE_TYPE")
58         private String serviceType;
59
60         @Column(name = "DESCRIPTION")
61         private String description;
62         @BusinessKey
63         @Column(name = "ORCHESTRATION_URI", nullable = false)
64         private String orchestrationUri;
65
66         @Column(name = "AR_PARAM_XSD")
67         private String paramXsd;
68
69         @Column(name = "RECIPE_TIMEOUT")
70         private Integer recipeTimeout;
71
72         @Column(name = "CREATION_TIMESTAMP", nullable = false, updatable = false)
73         @Temporal(TemporalType.TIMESTAMP)
74         private Date created;
75
76         public Integer getId() {
77                 return id;
78         }
79
80         public void setId(Integer id) {
81                 this.id = id;
82         }
83
84         public String getModelName() {
85                 return modelName;
86         }
87
88         public void setModelName(String modelName) {
89                 this.modelName = modelName;
90         }
91
92         public String getAction() {
93                 return action;
94         }
95
96         public void setAction(String action) {
97                 this.action = action;
98         }
99
100         public String getVersion() {
101                 return version;
102         }
103
104         public void setVersion(String version) {
105                 this.version = version;
106         }
107
108         public String getServiceType() {
109                 return serviceType;
110         }
111
112         public void setServiceType(String serviceType) {
113                 this.serviceType = serviceType;
114         }
115
116         public String getDescription() {
117                 return description;
118         }
119
120         public void setDescription(String description) {
121                 this.description = description;
122         }
123
124         public String getOrchestrationUri() {
125                 return orchestrationUri;
126         }
127
128         public void setOrchestrationUri(String orchestrationUri) {
129                 this.orchestrationUri = orchestrationUri;
130         }
131
132         public String getParamXsd() {
133                 return paramXsd;
134         }
135
136         public void setParamXsd(String paramXsd) {
137                 this.paramXsd = paramXsd;
138         }
139
140         public Integer getRecipeTimeout() {
141                 return recipeTimeout;
142         }
143
144         public void setRecipeTimeout(Integer recipeTimeout) {
145                 this.recipeTimeout = recipeTimeout;
146         }
147
148         public Date getCreated() {
149                 return created;
150         }
151
152         public void setCreated(Date created) {
153                 this.created = created;
154         }
155
156         @Override
157         public String toString() {
158                 return new ToStringBuilder(this).append("modelName", getModelName()).append("action", getAction())
159                                 .append("version", getVersion()).append("serviceType", getServiceType())
160                                 .append("description", getDescription()).append("orchestrationUri", getOrchestrationUri())
161                                 .append("paramXSD", getParamXsd()).append("recipeTimeout", getRecipeTimeout())
162                                 .append("created", getCreated()).toString();
163         }
164
165         @Override
166         public boolean equals(final Object other) {
167                 if (this == other) {
168                         return true;
169                 }
170                 if (!(other instanceof ArRecipe)) {
171                         return false;
172                 }
173                 ArRecipe castOther = (ArRecipe) other;
174                 return new EqualsBuilder().append(getId(), castOther.getId()).append(getModelName(), castOther.getModelName())
175                                 .append(getAction(), castOther.getAction()).append(getServiceType(), castOther.getServiceType())
176                                 .append(getOrchestrationUri(), castOther.getOrchestrationUri()).isEquals();
177         }
178
179         @Override
180         public int hashCode() {
181                 return new HashCodeBuilder().append(getId()).append(getModelName()).append(getAction()).append(getServiceType())
182                                 .append(getOrchestrationUri()).toHashCode();
183         }
184 }