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