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