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.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.ManyToOne;
35 import javax.persistence.OneToMany;
36 import javax.persistence.PrePersist;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40 import org.apache.commons.lang3.builder.EqualsBuilder;
41 import org.apache.commons.lang3.builder.HashCodeBuilder;
42 import org.apache.commons.lang3.builder.ToStringBuilder;
43 import com.fasterxml.jackson.annotation.JsonFormat;
44 import com.openpojo.business.annotation.BusinessKey;
45 import uk.co.blackpepper.bowman.annotation.LinkedResource;
46 import uk.co.blackpepper.bowman.annotation.RemoteResource;
49 @RemoteResource("/vfModuleCustomization")
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", nullable = false)
68 private Integer minInstances = 0;
70 @Column(name = "MAX_INSTANCES")
71 private Integer maxInstances;
73 @Column(name = "INITIAL_COUNT", nullable = false)
74 private Integer initialCount = 0;
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 List<CvnfcCustomization> cvnfcCustomization;
103 @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION", nullable = false)
104 private Boolean skipPostInstConf = true;
107 public boolean equals(final Object other) {
108 if (!(other instanceof VfModuleCustomization)) {
111 VfModuleCustomization castOther = (VfModuleCustomization) other;
112 return new EqualsBuilder().append(id, castOther.id).isEquals();
116 public int hashCode() {
117 return new HashCodeBuilder().append(id).toHashCode();
121 protected void onCreate() {
122 this.created = new Date();
126 public String toString() {
127 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID).append("label", label)
128 .append("minInstances", minInstances).append("maxInstances", maxInstances)
129 .append("initialCount", initialCount).append("availabilityZoneCount", availabilityZoneCount)
130 .append("created", created).append("volumeHeatEnv", volumeHeatEnv)
131 .append("heatEnvironment", heatEnvironment).append("vfModule", vfModule).toString();
136 public Integer getId() {
140 public void setId(Integer id) {
144 public VnfResourceCustomization getVnfCustomization() {
145 return vnfCustomization;
148 public void setVnfCustomization(VnfResourceCustomization vnfCustomization) {
149 this.vnfCustomization = vnfCustomization;
152 public VfModuleCustomization() {
156 public String getModelCustomizationUUID() {
157 return this.modelCustomizationUUID;
160 public void setModelCustomizationUUID(String modelCustomizationUUID) {
161 this.modelCustomizationUUID = modelCustomizationUUID;
165 public HeatEnvironment getVolumeHeatEnv() {
166 return volumeHeatEnv;
169 public void setVolumeHeatEnv(HeatEnvironment volumeHeatEnv) {
170 this.volumeHeatEnv = volumeHeatEnv;
174 public HeatEnvironment getHeatEnvironment() {
175 return heatEnvironment;
178 public void setHeatEnvironment(HeatEnvironment heatEnvironment) {
179 this.heatEnvironment = heatEnvironment;
182 public Integer getMinInstances() {
183 return this.minInstances;
186 public void setMinInstances(Integer minInstances) {
187 this.minInstances = minInstances;
190 public Integer getMaxInstances() {
191 return this.maxInstances;
194 public void setMaxInstances(Integer maxInstances) {
195 this.maxInstances = maxInstances;
198 public Integer getInitialCount() {
199 return this.initialCount;
202 public void setInitialCount(Integer initialCount) {
203 this.initialCount = initialCount;
206 public Integer getAvailabilityZoneCount() {
207 return this.availabilityZoneCount;
210 public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
211 this.availabilityZoneCount = availabilityZoneCount;
214 public Date getCreated() {
218 public String getLabel() {
222 public void setLabel(String label) {
227 public VfModule getVfModule() {
228 return this.vfModule;
231 public void setVfModule(VfModule vfModule) {
232 this.vfModule = vfModule;
236 public List<CvnfcCustomization> getCvnfcCustomization() {
237 if (cvnfcCustomization == null)
238 cvnfcCustomization = new ArrayList<>();
239 return cvnfcCustomization;
242 public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
243 this.cvnfcCustomization = cvnfcCustomization;
246 public Boolean getSkipPostInstConf() {
247 return skipPostInstConf;
250 public void setSkipPostInstConf(Boolean skipPostInstConf) {
251 this.skipPostInstConf = skipPostInstConf;