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;
28 import javax.persistence.CascadeType;
29 import javax.persistence.Column;
30 import javax.persistence.Entity;
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 org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
45 import com.fasterxml.jackson.annotation.JsonFormat;
46 import com.openpojo.business.annotation.BusinessKey;
47 import uk.co.blackpepper.bowman.annotation.LinkedResource;
50 @Table(name = "vf_module_customization")
51 public class VfModuleCustomization implements Serializable {
53 public static final long serialVersionUID = -1322322139926390329L;
58 @GeneratedValue(strategy = GenerationType.IDENTITY)
61 @Column(name = "MODEL_CUSTOMIZATION_UUID")
62 private String modelCustomizationUUID;
64 @Column(name = "LABEL")
67 @Column(name = "MIN_INSTANCES")
68 private Integer minInstances;
70 @Column(name = "MAX_INSTANCES")
71 private Integer maxInstances;
73 @Column(name = "INITIAL_COUNT")
74 private Integer initialCount;
76 @Column(name = "AVAILABILITY_ZONE_COUNT")
77 private Integer availabilityZoneCount;
79 @Column(name = "CREATION_TIMESTAMP", updatable = false)
80 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
81 @Temporal(TemporalType.TIMESTAMP)
84 @ManyToOne(cascade = CascadeType.ALL)
85 @JoinColumn(name = "VOL_ENVIRONMENT_ARTIFACT_UUID")
86 HeatEnvironment volumeHeatEnv;
88 @ManyToOne(cascade = CascadeType.ALL)
89 @JoinColumn(name = "HEAT_ENVIRONMENT_ARTIFACT_UUID")
90 HeatEnvironment heatEnvironment;
92 @ManyToOne(cascade = CascadeType.ALL)
93 @JoinColumn(name = "VF_MODULE_MODEL_UUID")
94 private VfModule vfModule;
96 @ManyToOne(cascade = CascadeType.ALL)
97 @JoinColumn(name = "VNF_RESOURCE_CUSTOMIZATION_ID")
98 private VnfResourceCustomization vnfCustomization;
100 @OneToMany(cascade = CascadeType.ALL, mappedBy = "vfModuleCustomization")
101 private Set<CvnfcCustomization> cvnfcCustomization;
104 public boolean equals(final Object other) {
105 if (!(other instanceof VfModuleCustomization)) {
108 VfModuleCustomization castOther = (VfModuleCustomization) other;
109 return new EqualsBuilder().append(id, castOther.id).isEquals();
113 public int hashCode() {
114 return new HashCodeBuilder().append(id).toHashCode();
118 protected void onCreate() {
119 this.created = new Date();
123 public String toString() {
124 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID).append("label", label)
125 .append("minInstances", minInstances).append("maxInstances", maxInstances)
126 .append("initialCount", initialCount).append("availabilityZoneCount", availabilityZoneCount)
127 .append("created", created).append("volumeHeatEnv", volumeHeatEnv)
128 .append("heatEnvironment", heatEnvironment).append("vfModule", vfModule).toString();
133 public Integer getId() {
137 public void setId(Integer id) {
141 public VnfResourceCustomization getVnfCustomization() {
142 return vnfCustomization;
145 public void setVnfCustomization(VnfResourceCustomization vnfCustomization) {
146 this.vnfCustomization = vnfCustomization;
149 public VfModuleCustomization() {
153 public String getModelCustomizationUUID() {
154 return this.modelCustomizationUUID;
157 public void setModelCustomizationUUID(String modelCustomizationUUID) {
158 this.modelCustomizationUUID = modelCustomizationUUID;
162 public HeatEnvironment getVolumeHeatEnv() {
163 return volumeHeatEnv;
166 public void setVolumeHeatEnv(HeatEnvironment volumeHeatEnv) {
167 this.volumeHeatEnv = volumeHeatEnv;
171 public HeatEnvironment getHeatEnvironment() {
172 return heatEnvironment;
175 public void setHeatEnvironment(HeatEnvironment heatEnvironment) {
176 this.heatEnvironment = heatEnvironment;
179 public Integer getMinInstances() {
180 return this.minInstances;
183 public void setMinInstances(Integer minInstances) {
184 this.minInstances = minInstances;
187 public Integer getMaxInstances() {
188 return this.maxInstances;
191 public void setMaxInstances(Integer maxInstances) {
192 this.maxInstances = maxInstances;
195 public Integer getInitialCount() {
196 return this.initialCount;
199 public void setInitialCount(Integer initialCount) {
200 this.initialCount = initialCount;
203 public Integer getAvailabilityZoneCount() {
204 return this.availabilityZoneCount;
207 public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
208 this.availabilityZoneCount = availabilityZoneCount;
211 public Date getCreated() {
215 public String getLabel() {
219 public void setLabel(String label) {
224 public VfModule getVfModule() {
225 return this.vfModule;
228 public void setVfModule(VfModule vfModule) {
229 this.vfModule = vfModule;
233 public Set<CvnfcCustomization> getCvnfcCustomization() {
234 if (cvnfcCustomization == null)
235 cvnfcCustomization = new HashSet<>();
236 return cvnfcCustomization;
239 public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) {
240 this.cvnfcCustomization = cvnfcCustomization;