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.HashSet;
27 import java.util.List;
30 import javax.persistence.CascadeType;
31 import javax.persistence.Column;
32 import javax.persistence.Entity;
33 import javax.persistence.FetchType;
34 import javax.persistence.GeneratedValue;
35 import javax.persistence.GenerationType;
36 import javax.persistence.Id;
37 import javax.persistence.JoinColumn;
38 import javax.persistence.JoinTable;
39 import javax.persistence.ManyToOne;
40 import javax.persistence.OneToMany;
41 import javax.persistence.PrePersist;
42 import javax.persistence.Table;
43 import javax.persistence.Temporal;
44 import javax.persistence.TemporalType;
46 import org.apache.commons.lang3.builder.EqualsBuilder;
47 import org.apache.commons.lang3.builder.HashCodeBuilder;
48 import org.apache.commons.lang3.builder.ToStringBuilder;
50 import com.fasterxml.jackson.annotation.JsonFormat;
51 import com.openpojo.business.annotation.BusinessKey;
53 import uk.co.blackpepper.bowman.annotation.LinkedResource;
56 @Table(name = "vnf_resource_customization")
57 public class VnfResourceCustomization implements Serializable {
59 private static final long serialVersionUID = 768026109321305392L;
64 @GeneratedValue(strategy = GenerationType.IDENTITY)
67 @Column(name = "MODEL_CUSTOMIZATION_UUID")
68 private String modelCustomizationUUID;
70 @Column(name = "MODEL_INSTANCE_NAME")
71 private String modelInstanceName;
73 @Column(name = "CREATION_TIMESTAMP", updatable = false)
74 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
75 @Temporal(TemporalType.TIMESTAMP)
78 @Column(name = "MIN_INSTANCES")
79 private Integer minInstances;
81 @Column(name = "MAX_INSTANCES")
82 private Integer maxInstances;
84 @Column(name = "AVAILABILITY_ZONE_MAX_COUNT")
85 private Integer availabilityZoneMaxCount;
87 @Column(name = "NF_FUNCTION")
88 private String nfFunction;
90 @Column(name = "NF_TYPE")
91 private String nfType;
93 @Column(name = "NF_ROLE")
94 private String nfRole;
96 @Column(name = "NF_NAMING_CODE")
97 private String nfNamingCode;
99 @Column(name = "MULTI_STAGE_DESIGN")
100 private String multiStageDesign;
102 @Column(name = "RESOURCE_INPUT")
103 private String resourceInput;
105 @ManyToOne(cascade = CascadeType.ALL)
106 @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
107 private VnfResource vnfResources;
109 @ManyToOne(cascade = CascadeType.ALL)
110 @JoinColumn(name = "SERVICE_MODEL_UUID")
111 private Service service;
113 @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER, mappedBy = "vnfCustomization")
114 private List<VfModuleCustomization> vfModuleCustomizations;
116 @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust")
117 private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations = new ArrayList<>();
119 @Column(name = "CDS_BLUEPRINT_NAME")
120 private String blueprintName;
122 @Column(name = "CDS_BLUEPRINT_VERSION")
123 private String blueprintVersion;
126 public boolean equals(final Object other) {
127 if (!(other instanceof VnfResourceCustomization)) {
130 VnfResourceCustomization castOther = (VnfResourceCustomization) other;
131 return new EqualsBuilder().append(id, castOther.id).isEquals();
135 public int hashCode() {
136 return new HashCodeBuilder().append(id).toHashCode();
139 public void setCreated(Date created) {
140 this.created = created;
144 public String toString() {
145 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
146 .append("modelInstanceName", modelInstanceName).append("created", created)
147 .append("minInstances", minInstances).append("maxInstances", maxInstances)
148 .append("availabilityZoneMaxCount", availabilityZoneMaxCount).append("nfFunction", nfFunction)
149 .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
150 .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources)
151 .append("vfModuleCustomizations", vfModuleCustomizations)
152 .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString();
156 protected void onCreate() {
157 this.created = new Date();
160 public String getModelCustomizationUUID() {
161 return modelCustomizationUUID;
164 public void setModelCustomizationUUID(String modelCustomizationUUID) {
165 this.modelCustomizationUUID = modelCustomizationUUID;
168 public Integer getId() {
172 public void setId(Integer id) {
177 public Service getService() {
181 public void setService(Service service) {
182 this.service = service;
185 public String getModelInstanceName() {
186 return this.modelInstanceName;
189 public void setModelInstanceName(String modelInstanceName) {
190 this.modelInstanceName = modelInstanceName;
193 public Date getCreationTimestamp() {
197 public Integer getMinInstances() {
198 return this.minInstances;
201 public void setMinInstances(Integer minInstances) {
202 this.minInstances = minInstances;
205 public Integer getMaxInstances() {
206 return this.maxInstances;
209 public void setMaxInstances(Integer maxInstances) {
210 this.maxInstances = maxInstances;
213 public Integer getAvailabilityZoneMaxCount() {
214 return this.availabilityZoneMaxCount;
217 public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
218 this.availabilityZoneMaxCount = availabilityZoneMaxCount;
221 public String getNfFunction() {
225 public void setNfFunction(String nfFunction) {
226 this.nfFunction = nfFunction;
229 public String getNfType() {
233 public void setNfType(String nfType) {
234 this.nfType = nfType;
237 public String getNfRole() {
241 public void setNfRole(String nfRole) {
242 this.nfRole = nfRole;
245 public String getNfNamingCode() {
249 public void setNfNamingCode(String nfNamingCode) {
250 this.nfNamingCode = nfNamingCode;
253 public String getMultiStageDesign() {
254 return this.multiStageDesign;
257 public void setMultiStageDesign(String multiStageDesign) {
258 this.multiStageDesign = multiStageDesign;
262 public List<VfModuleCustomization> getVfModuleCustomizations() {
263 if (vfModuleCustomizations == null) {
264 vfModuleCustomizations = new ArrayList<>();
266 return vfModuleCustomizations;
269 public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
270 this.vfModuleCustomizations = vfModuleCustomizations;
274 public VnfResource getVnfResources() {
278 public void setVnfResources(VnfResource vnfResources) {
279 this.vnfResources = vnfResources;
282 public Date getCreated() {
287 public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupCustomizations() {
288 return vnfcInstanceGroupCustomizations;
291 public void setVnfcInstanceGroupCustomizations(
292 List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
293 this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations;
296 public String getResourceInput() {
297 return resourceInput;
300 public void setResourceInput(String resourceInput) {
301 this.resourceInput = resourceInput;
305 public String getBlueprintName() {
306 return blueprintName;
309 public void setBlueprintName(String blueprintName) {
310 this.blueprintName = blueprintName;
313 public String getBlueprintVersion() {
314 return blueprintVersion;
317 public void setBlueprintVersion(String blueprintVersion) {
318 this.blueprintVersion = blueprintVersion;