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