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;
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.Id;
30 import javax.persistence.JoinColumn;
31 import javax.persistence.ManyToOne;
32 import javax.persistence.PrePersist;
33 import javax.persistence.Table;
34 import javax.persistence.Temporal;
35 import javax.persistence.TemporalType;
37 import org.apache.commons.lang3.builder.EqualsBuilder;
38 import org.apache.commons.lang3.builder.HashCodeBuilder;
39 import org.apache.commons.lang3.builder.ToStringBuilder;
41 import com.fasterxml.jackson.annotation.JsonFormat;
42 import com.openpojo.business.annotation.BusinessKey;
44 import uk.co.blackpepper.bowman.annotation.LinkedResource;
47 @Table(name = "vf_module_customization")
48 public class VfModuleCustomization implements Serializable {
50 public static final long serialVersionUID = -1322322139926390329L;
54 @Column(name = "MODEL_CUSTOMIZATION_UUID")
55 private String modelCustomizationUUID;
57 @Column(name = "LABEL")
60 @Column(name = "MIN_INSTANCES")
61 private Integer minInstances;
63 @Column(name = "MAX_INSTANCES")
64 private Integer maxInstances;
66 @Column(name = "INITIAL_COUNT")
67 private Integer initialCount;
69 @Column(name = "AVAILABILITY_ZONE_COUNT")
70 private Integer availabilityZoneCount;
72 @Column(name = "CREATION_TIMESTAMP", updatable = false)
73 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
74 @Temporal(TemporalType.TIMESTAMP)
77 @ManyToOne(cascade = CascadeType.ALL)
78 @JoinColumn(name = "VOL_ENVIRONMENT_ARTIFACT_UUID")
79 HeatEnvironment volumeHeatEnv;
81 @ManyToOne(cascade = CascadeType.ALL)
82 @JoinColumn(name = "HEAT_ENVIRONMENT_ARTIFACT_UUID")
83 HeatEnvironment heatEnvironment;
85 @ManyToOne(cascade = CascadeType.ALL)
86 @JoinColumn(name = "VF_MODULE_MODEL_UUID")
87 private VfModule vfModule;
90 protected void onCreate() {
91 this.created = new Date();
95 public String toString() {
96 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID).append("label", label)
97 .append("minInstances", minInstances).append("maxInstances", maxInstances)
98 .append("initialCount", initialCount).append("availabilityZoneCount", availabilityZoneCount)
99 .append("created", created).append("volumeHeatEnv", volumeHeatEnv)
100 .append("heatEnvironment", heatEnvironment).append("vfModule", vfModule).toString();
104 public boolean equals(final Object other) {
105 if (!(other instanceof VfModuleCustomization)) {
108 VfModuleCustomization castOther = (VfModuleCustomization) other;
109 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
113 public int hashCode() {
114 return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
117 public VfModuleCustomization() {
121 public String getModelCustomizationUUID() {
122 return this.modelCustomizationUUID;
125 public void setModelCustomizationUUID(String modelCustomizationUUID) {
126 this.modelCustomizationUUID = modelCustomizationUUID;
130 public HeatEnvironment getVolumeHeatEnv() {
131 return volumeHeatEnv;
134 public void setVolumeHeatEnv(HeatEnvironment volumeHeatEnv) {
135 this.volumeHeatEnv = volumeHeatEnv;
139 public HeatEnvironment getHeatEnvironment() {
140 return heatEnvironment;
143 public void setHeatEnvironment(HeatEnvironment heatEnvironment) {
144 this.heatEnvironment = heatEnvironment;
147 public Integer getMinInstances() {
148 return this.minInstances;
151 public void setMinInstances(Integer minInstances) {
152 this.minInstances = minInstances;
155 public Integer getMaxInstances() {
156 return this.maxInstances;
159 public void setMaxInstances(Integer maxInstances) {
160 this.maxInstances = maxInstances;
163 public Integer getInitialCount() {
164 return this.initialCount;
167 public void setInitialCount(Integer initialCount) {
168 this.initialCount = initialCount;
171 public Integer getAvailabilityZoneCount() {
172 return this.availabilityZoneCount;
175 public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
176 this.availabilityZoneCount = availabilityZoneCount;
179 public Date getCreated() {
183 public String getLabel() {
187 public void setLabel(String label) {
192 public VfModule getVfModule() {
193 return this.vfModule;
196 public void setVfModule(VfModule vfModule) {
197 this.vfModule = vfModule;