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