2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.db.catalog.beans;
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;
50 @RemoteResource("/vnfResourceCustomization")
51 @Table(name = "vnf_resource_customization")
52 public class VnfResourceCustomization implements Serializable {
54 private static final long serialVersionUID = 768026109321305392L;
59 @GeneratedValue(strategy = GenerationType.IDENTITY)
62 @Column(name = "MODEL_CUSTOMIZATION_UUID")
63 private String modelCustomizationUUID;
65 @Column(name = "MODEL_INSTANCE_NAME")
66 private String modelInstanceName;
68 @Column(name = "CREATION_TIMESTAMP", updatable = false)
69 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
70 @Temporal(TemporalType.TIMESTAMP)
73 @Column(name = "MIN_INSTANCES")
74 private Integer minInstances;
76 @Column(name = "MAX_INSTANCES")
77 private Integer maxInstances;
79 @Column(name = "AVAILABILITY_ZONE_MAX_COUNT")
80 private Integer availabilityZoneMaxCount;
82 @Column(name = "NF_FUNCTION")
83 private String nfFunction;
85 @Column(name = "NF_TYPE")
86 private String nfType;
88 @Column(name = "NF_ROLE")
89 private String nfRole;
91 @Column(name = "NF_NAMING_CODE")
92 private String nfNamingCode;
94 @Column(name = "MULTI_STAGE_DESIGN")
95 private String multiStageDesign;
97 @Column(name = "RESOURCE_INPUT")
98 private String resourceInput;
100 @ManyToOne(cascade = CascadeType.ALL)
101 @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
102 private VnfResource vnfResources;
104 @ManyToOne(cascade = CascadeType.ALL)
105 @JoinColumn(name = "SERVICE_MODEL_UUID")
106 private Service service;
108 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "vnfCustomization")
109 private List<VfModuleCustomization> vfModuleCustomizations;
111 @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust")
112 private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations = new ArrayList<>();
114 @Column(name = "CDS_BLUEPRINT_NAME")
115 private String blueprintName;
117 @Column(name = "CDS_BLUEPRINT_VERSION")
118 private String blueprintVersion;
120 @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION", nullable = false)
121 private Boolean skipPostInstConf = true;
123 @Column(name = "VNFCINSTANCEGROUP_ORDER")
124 private String vnfcInstanceGroupOrder;
126 @Column(name = "NF_DATA_VALID", nullable = false)
127 private Boolean nfDataValid = false;
129 @Column(name = "CONTROLLER_ACTOR")
130 private String controllerActor;
133 public boolean equals(final Object other) {
134 if (!(other instanceof VnfResourceCustomization)) {
137 VnfResourceCustomization castOther = (VnfResourceCustomization) other;
138 return new EqualsBuilder().append(id, castOther.id).isEquals();
142 public int hashCode() {
143 return new HashCodeBuilder().append(id).toHashCode();
146 public void setCreated(Date created) {
147 this.created = created;
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();
165 protected void onCreate() {
166 this.created = new Date();
169 public String getModelCustomizationUUID() {
170 return modelCustomizationUUID;
173 public void setModelCustomizationUUID(String modelCustomizationUUID) {
174 this.modelCustomizationUUID = modelCustomizationUUID;
177 public Integer getId() {
181 public void setId(Integer id) {
186 public Service getService() {
190 public void setService(Service service) {
191 this.service = service;
194 public String getModelInstanceName() {
195 return this.modelInstanceName;
198 public void setModelInstanceName(String modelInstanceName) {
199 this.modelInstanceName = modelInstanceName;
202 public Date getCreationTimestamp() {
206 public Integer getMinInstances() {
207 return this.minInstances;
210 public void setMinInstances(Integer minInstances) {
211 this.minInstances = minInstances;
214 public Integer getMaxInstances() {
215 return this.maxInstances;
218 public void setMaxInstances(Integer maxInstances) {
219 this.maxInstances = maxInstances;
222 public Integer getAvailabilityZoneMaxCount() {
223 return this.availabilityZoneMaxCount;
226 public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
227 this.availabilityZoneMaxCount = availabilityZoneMaxCount;
230 public String getNfFunction() {
234 public void setNfFunction(String nfFunction) {
235 this.nfFunction = nfFunction;
238 public String getNfType() {
242 public void setNfType(String nfType) {
243 this.nfType = nfType;
246 public String getNfRole() {
250 public void setNfRole(String nfRole) {
251 this.nfRole = nfRole;
254 public String getNfNamingCode() {
258 public void setNfNamingCode(String nfNamingCode) {
259 this.nfNamingCode = nfNamingCode;
262 public String getMultiStageDesign() {
263 return this.multiStageDesign;
266 public void setMultiStageDesign(String multiStageDesign) {
267 this.multiStageDesign = multiStageDesign;
271 public List<VfModuleCustomization> getVfModuleCustomizations() {
272 if (vfModuleCustomizations == null) {
273 vfModuleCustomizations = new ArrayList<>();
275 return vfModuleCustomizations;
278 public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
279 this.vfModuleCustomizations = vfModuleCustomizations;
283 public VnfResource getVnfResources() {
287 public void setVnfResources(VnfResource vnfResources) {
288 this.vnfResources = vnfResources;
291 public Date getCreated() {
296 public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupCustomizations() {
297 return vnfcInstanceGroupCustomizations;
300 public void setVnfcInstanceGroupCustomizations(
301 List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
302 this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations;
305 public String getResourceInput() {
306 return resourceInput;
309 public void setResourceInput(String resourceInput) {
310 this.resourceInput = resourceInput;
314 public String getBlueprintName() {
315 return blueprintName;
318 public void setBlueprintName(String blueprintName) {
319 this.blueprintName = blueprintName;
322 public String getBlueprintVersion() {
323 return blueprintVersion;
326 public void setBlueprintVersion(String blueprintVersion) {
327 this.blueprintVersion = blueprintVersion;
330 public Boolean getSkipPostInstConf() {
331 return skipPostInstConf;
334 public void setSkipPostInstConf(Boolean skipPostInstConf) {
335 this.skipPostInstConf = skipPostInstConf;
338 public String getVnfcInstanceGroupOrder() {
339 return vnfcInstanceGroupOrder;
342 public void setVnfcInstanceGroupOrder(String vnfcInstanceGroupOrder) {
343 this.vnfcInstanceGroupOrder = vnfcInstanceGroupOrder;
346 public Boolean getNfDataValid() {
350 public void setNfDataValid(Boolean nfDataValid) {
351 this.nfDataValid = nfDataValid;
354 public String getControllerActor() {
355 return controllerActor;
358 public void setControllerActor(String controllerActor) {
359 this.controllerActor = controllerActor;