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.Date;
25 import java.util.HashSet;
26 import java.util.List;
29 import javax.persistence.CascadeType;
30 import javax.persistence.Column;
31 import javax.persistence.Entity;
32 import javax.persistence.GeneratedValue;
33 import javax.persistence.GenerationType;
34 import javax.persistence.Id;
35 import javax.persistence.JoinColumn;
36 import javax.persistence.ManyToOne;
37 import javax.persistence.OneToMany;
38 import javax.persistence.PrePersist;
39 import javax.persistence.Table;
40 import javax.persistence.Temporal;
41 import javax.persistence.TemporalType;
43 import org.apache.commons.lang3.builder.EqualsBuilder;
44 import org.apache.commons.lang3.builder.HashCodeBuilder;
45 import org.apache.commons.lang3.builder.ToStringBuilder;
46 import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
48 import com.fasterxml.jackson.annotation.JsonFormat;
49 import com.openpojo.business.annotation.BusinessKey;
51 import uk.co.blackpepper.bowman.annotation.LinkedResource;
54 @Table(name = "vf_module_customization")
55 public class VfModuleCustomization implements Serializable {
57 public static final long serialVersionUID = -1322322139926390329L;
62 @GeneratedValue(strategy = GenerationType.IDENTITY)
65 @Column(name = "MODEL_CUSTOMIZATION_UUID")
66 private String modelCustomizationUUID;
68 @Column(name = "LABEL")
71 @Column(name = "MIN_INSTANCES")
72 private Integer minInstances;
74 @Column(name = "MAX_INSTANCES")
75 private Integer maxInstances;
77 @Column(name = "INITIAL_COUNT")
78 private Integer initialCount;
80 @Column(name = "AVAILABILITY_ZONE_COUNT")
81 private Integer availabilityZoneCount;
83 @Column(name = "CREATION_TIMESTAMP", updatable = false)
84 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
85 @Temporal(TemporalType.TIMESTAMP)
88 @ManyToOne(cascade = CascadeType.ALL)
89 @JoinColumn(name = "VOL_ENVIRONMENT_ARTIFACT_UUID")
90 HeatEnvironment volumeHeatEnv;
92 @ManyToOne(cascade = CascadeType.ALL)
93 @JoinColumn(name = "HEAT_ENVIRONMENT_ARTIFACT_UUID")
94 HeatEnvironment heatEnvironment;
96 @ManyToOne(cascade = CascadeType.ALL)
97 @JoinColumn(name = "VF_MODULE_MODEL_UUID")
98 private VfModule vfModule;
100 @ManyToOne(cascade = CascadeType.ALL)
101 @JoinColumn(name = "VNF_RESOURCE_CUSTOMIZATION_ID")
102 private VnfResourceCustomization vnfCustomization;
104 @OneToMany(cascade = CascadeType.ALL, mappedBy = "vfModuleCustomization")
105 private Set<CvnfcCustomization> cvnfcCustomization;
108 public boolean equals(final Object other) {
109 if (!(other instanceof VfModuleCustomization)) {
112 VfModuleCustomization castOther = (VfModuleCustomization) other;
113 return new EqualsBuilder().append(id, castOther.id).isEquals();
117 public int hashCode() {
118 return new HashCodeBuilder().append(id).toHashCode();
122 protected void onCreate() {
123 this.created = new Date();
127 public String toString() {
128 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID).append("label", label)
129 .append("minInstances", minInstances).append("maxInstances", maxInstances)
130 .append("initialCount", initialCount).append("availabilityZoneCount", availabilityZoneCount)
131 .append("created", created).append("volumeHeatEnv", volumeHeatEnv)
132 .append("heatEnvironment", heatEnvironment).append("vfModule", vfModule).toString();
137 public Integer getId() {
141 public void setId(Integer id) {
145 public VnfResourceCustomization getVnfCustomization() {
146 return vnfCustomization;
149 public void setVnfCustomization(VnfResourceCustomization vnfCustomization) {
150 this.vnfCustomization = vnfCustomization;
153 public VfModuleCustomization() {
157 public String getModelCustomizationUUID() {
158 return this.modelCustomizationUUID;
161 public void setModelCustomizationUUID(String modelCustomizationUUID) {
162 this.modelCustomizationUUID = modelCustomizationUUID;
166 public HeatEnvironment getVolumeHeatEnv() {
167 return volumeHeatEnv;
170 public void setVolumeHeatEnv(HeatEnvironment volumeHeatEnv) {
171 this.volumeHeatEnv = volumeHeatEnv;
175 public HeatEnvironment getHeatEnvironment() {
176 return heatEnvironment;
179 public void setHeatEnvironment(HeatEnvironment heatEnvironment) {
180 this.heatEnvironment = heatEnvironment;
183 public Integer getMinInstances() {
184 return this.minInstances;
187 public void setMinInstances(Integer minInstances) {
188 this.minInstances = minInstances;
191 public Integer getMaxInstances() {
192 return this.maxInstances;
195 public void setMaxInstances(Integer maxInstances) {
196 this.maxInstances = maxInstances;
199 public Integer getInitialCount() {
200 return this.initialCount;
203 public void setInitialCount(Integer initialCount) {
204 this.initialCount = initialCount;
207 public Integer getAvailabilityZoneCount() {
208 return this.availabilityZoneCount;
211 public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
212 this.availabilityZoneCount = availabilityZoneCount;
215 public Date getCreated() {
219 public String getLabel() {
223 public void setLabel(String label) {
228 public VfModule getVfModule() {
229 return this.vfModule;
232 public void setVfModule(VfModule vfModule) {
233 this.vfModule = vfModule;
237 public Set<CvnfcCustomization> getCvnfcCustomization() {
238 if (cvnfcCustomization == null)
239 cvnfcCustomization = new HashSet<>();
240 return cvnfcCustomization;
243 public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) {
244 this.cvnfcCustomization = cvnfcCustomization;