[SO] Release so 1.13.0 image
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / VnfResourceCustomization.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.ArrayList;
25 import java.util.Date;
26 import java.util.List;
27 import javax.persistence.CascadeType;
28 import javax.persistence.Column;
29 import javax.persistence.Entity;
30 import javax.persistence.FetchType;
31 import javax.persistence.GeneratedValue;
32 import javax.persistence.GenerationType;
33 import javax.persistence.Id;
34 import javax.persistence.JoinColumn;
35 import javax.persistence.ManyToOne;
36 import javax.persistence.OneToMany;
37 import javax.persistence.PrePersist;
38 import javax.persistence.Table;
39 import javax.persistence.Temporal;
40 import javax.persistence.TemporalType;
41 import org.apache.commons.lang3.builder.EqualsBuilder;
42 import org.apache.commons.lang3.builder.HashCodeBuilder;
43 import org.apache.commons.lang3.builder.ToStringBuilder;
44 import com.fasterxml.jackson.annotation.JsonFormat;
45 import com.openpojo.business.annotation.BusinessKey;
46 import uk.co.blackpepper.bowman.annotation.LinkedResource;
47 import uk.co.blackpepper.bowman.annotation.RemoteResource;
48
49 @Entity
50 @RemoteResource("/vnfResourceCustomization")
51 @Table(name = "vnf_resource_customization")
52 public class VnfResourceCustomization implements Serializable {
53
54     private static final long serialVersionUID = 768026109321305392L;
55
56     @Id
57     @BusinessKey
58     @Column(name = "ID")
59     @GeneratedValue(strategy = GenerationType.IDENTITY)
60     private Integer id;
61
62     @Column(name = "MODEL_CUSTOMIZATION_UUID")
63     private String modelCustomizationUUID;
64
65     @Column(name = "MODEL_INSTANCE_NAME")
66     private String modelInstanceName;
67
68     @Column(name = "CREATION_TIMESTAMP", updatable = false)
69     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
70     @Temporal(TemporalType.TIMESTAMP)
71     private Date created;
72
73     @Column(name = "MIN_INSTANCES")
74     private Integer minInstances;
75
76     @Column(name = "MAX_INSTANCES")
77     private Integer maxInstances;
78
79     @Column(name = "AVAILABILITY_ZONE_MAX_COUNT")
80     private Integer availabilityZoneMaxCount;
81
82     @Column(name = "NF_FUNCTION")
83     private String nfFunction;
84
85     @Column(name = "NF_TYPE")
86     private String nfType;
87
88     @Column(name = "NF_ROLE")
89     private String nfRole;
90
91     @Column(name = "NF_NAMING_CODE")
92     private String nfNamingCode;
93
94     @Column(name = "MULTI_STAGE_DESIGN")
95     private String multiStageDesign;
96
97     @Column(name = "RESOURCE_INPUT")
98     private String resourceInput;
99
100     @ManyToOne(cascade = CascadeType.ALL)
101     @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
102     private VnfResource vnfResources;
103
104     @ManyToOne(cascade = CascadeType.ALL)
105     @JoinColumn(name = "SERVICE_MODEL_UUID")
106     private Service service;
107
108     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "vnfCustomization")
109     private List<VfModuleCustomization> vfModuleCustomizations;
110
111     @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust")
112     private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations = new ArrayList<>();
113
114     @Column(name = "CDS_BLUEPRINT_NAME")
115     private String blueprintName;
116
117     @Column(name = "CDS_BLUEPRINT_VERSION")
118     private String blueprintVersion;
119
120     @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION", nullable = false)
121     private Boolean skipPostInstConf = true;
122
123     @Column(name = "VNFCINSTANCEGROUP_ORDER")
124     private String vnfcInstanceGroupOrder;
125
126     @Column(name = "NF_DATA_VALID", nullable = false)
127     private Boolean nfDataValid = false;
128
129     @Column(name = "CONTROLLER_ACTOR")
130     private String controllerActor;
131
132     @Override
133     public boolean equals(final Object other) {
134         if (!(other instanceof VnfResourceCustomization)) {
135             return false;
136         }
137         VnfResourceCustomization castOther = (VnfResourceCustomization) other;
138         return new EqualsBuilder().append(id, castOther.id).isEquals();
139     }
140
141     @Override
142     public int hashCode() {
143         return new HashCodeBuilder().append(id).toHashCode();
144     }
145
146     public void setCreated(Date created) {
147         this.created = created;
148     }
149
150     @Override
151     public String toString() {
152         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
153                 .append("modelInstanceName", modelInstanceName).append("created", created)
154                 .append("minInstances", minInstances).append("maxInstances", maxInstances)
155                 .append("availabilityZoneMaxCount", availabilityZoneMaxCount).append("nfFunction", nfFunction)
156                 .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
157                 .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources)
158                 .append("vfModuleCustomizations", vfModuleCustomizations)
159                 .append("vnfcInstanceGroupOrder", vnfcInstanceGroupOrder)
160                 .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations)
161                 .append("controllerActor", controllerActor).append("resourceInput", resourceInput).toString();
162     }
163
164     @PrePersist
165     protected void onCreate() {
166         this.created = new Date();
167     }
168
169     public String getModelCustomizationUUID() {
170         return modelCustomizationUUID;
171     }
172
173     public void setModelCustomizationUUID(String modelCustomizationUUID) {
174         this.modelCustomizationUUID = modelCustomizationUUID;
175     }
176
177     public Integer getId() {
178         return id;
179     }
180
181     public void setId(Integer id) {
182         this.id = id;
183     }
184
185     @LinkedResource
186     public Service getService() {
187         return service;
188     }
189
190     public void setService(Service service) {
191         this.service = service;
192     }
193
194     public String getModelInstanceName() {
195         return this.modelInstanceName;
196     }
197
198     public void setModelInstanceName(String modelInstanceName) {
199         this.modelInstanceName = modelInstanceName;
200     }
201
202     public Date getCreationTimestamp() {
203         return this.created;
204     }
205
206     public Integer getMinInstances() {
207         return this.minInstances;
208     }
209
210     public void setMinInstances(Integer minInstances) {
211         this.minInstances = minInstances;
212     }
213
214     public Integer getMaxInstances() {
215         return this.maxInstances;
216     }
217
218     public void setMaxInstances(Integer maxInstances) {
219         this.maxInstances = maxInstances;
220     }
221
222     public Integer getAvailabilityZoneMaxCount() {
223         return this.availabilityZoneMaxCount;
224     }
225
226     public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
227         this.availabilityZoneMaxCount = availabilityZoneMaxCount;
228     }
229
230     public String getNfFunction() {
231         return nfFunction;
232     }
233
234     public void setNfFunction(String nfFunction) {
235         this.nfFunction = nfFunction;
236     }
237
238     public String getNfType() {
239         return nfType;
240     }
241
242     public void setNfType(String nfType) {
243         this.nfType = nfType;
244     }
245
246     public String getNfRole() {
247         return nfRole;
248     }
249
250     public void setNfRole(String nfRole) {
251         this.nfRole = nfRole;
252     }
253
254     public String getNfNamingCode() {
255         return nfNamingCode;
256     }
257
258     public void setNfNamingCode(String nfNamingCode) {
259         this.nfNamingCode = nfNamingCode;
260     }
261
262     public String getMultiStageDesign() {
263         return this.multiStageDesign;
264     }
265
266     public void setMultiStageDesign(String multiStageDesign) {
267         this.multiStageDesign = multiStageDesign;
268     }
269
270     @LinkedResource
271     public List<VfModuleCustomization> getVfModuleCustomizations() {
272         if (vfModuleCustomizations == null) {
273             vfModuleCustomizations = new ArrayList<>();
274         }
275         return vfModuleCustomizations;
276     }
277
278     public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
279         this.vfModuleCustomizations = vfModuleCustomizations;
280     }
281
282     @LinkedResource
283     public VnfResource getVnfResources() {
284         return vnfResources;
285     }
286
287     public void setVnfResources(VnfResource vnfResources) {
288         this.vnfResources = vnfResources;
289     }
290
291     public Date getCreated() {
292         return created;
293     }
294
295     @LinkedResource
296     public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupCustomizations() {
297         return vnfcInstanceGroupCustomizations;
298     }
299
300     public void setVnfcInstanceGroupCustomizations(
301             List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
302         this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations;
303     }
304
305     public String getResourceInput() {
306         return resourceInput;
307     }
308
309     public void setResourceInput(String resourceInput) {
310         this.resourceInput = resourceInput;
311     }
312
313
314     public String getBlueprintName() {
315         return blueprintName;
316     }
317
318     public void setBlueprintName(String blueprintName) {
319         this.blueprintName = blueprintName;
320     }
321
322     public String getBlueprintVersion() {
323         return blueprintVersion;
324     }
325
326     public void setBlueprintVersion(String blueprintVersion) {
327         this.blueprintVersion = blueprintVersion;
328     }
329
330     public Boolean getSkipPostInstConf() {
331         return skipPostInstConf;
332     }
333
334     public void setSkipPostInstConf(Boolean skipPostInstConf) {
335         this.skipPostInstConf = skipPostInstConf;
336     }
337
338     public String getVnfcInstanceGroupOrder() {
339         return vnfcInstanceGroupOrder;
340     }
341
342     public void setVnfcInstanceGroupOrder(String vnfcInstanceGroupOrder) {
343         this.vnfcInstanceGroupOrder = vnfcInstanceGroupOrder;
344     }
345
346     public Boolean getNfDataValid() {
347         return nfDataValid;
348     }
349
350     public void setNfDataValid(Boolean nfDataValid) {
351         this.nfDataValid = nfDataValid;
352     }
353
354     public String getControllerActor() {
355         return controllerActor;
356     }
357
358     public void setControllerActor(String controllerActor) {
359         this.controllerActor = controllerActor;
360     }
361 }