2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 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.FetchType;
30 import javax.persistence.Id;
31 import javax.persistence.IdClass;
32 import javax.persistence.JoinColumn;
33 import javax.persistence.ManyToOne;
34 import javax.persistence.PrePersist;
35 import javax.persistence.Table;
36 import javax.persistence.Temporal;
37 import javax.persistence.TemporalType;
39 import org.apache.commons.lang3.builder.EqualsBuilder;
40 import org.apache.commons.lang3.builder.HashCodeBuilder;
41 import org.apache.commons.lang3.builder.ToStringBuilder;
43 import com.openpojo.business.annotation.BusinessKey;
45 import uk.co.blackpepper.bowman.annotation.LinkedResource;
48 @IdClass(VnfcInstanceGroupCustomizationId.class)
49 @Table(name = "vnfc_instance_group_customization")
50 public class VnfcInstanceGroupCustomization implements Serializable {
55 private static final long serialVersionUID = -8288218040186901676L;
59 @Column(name = "VNF_RESOURCE_CUSTOMIZATION_MODEL_UUID")
60 private String modelCustomizationUUID;
64 @Column(name = "INSTANCE_GROUP_MODEL_UUID")
65 private String modelUUID;
67 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
68 @JoinColumn(name = "VNF_RESOURCE_CUSTOMIZATION_MODEL_UUID", updatable = false, insertable = false)
69 private VnfResourceCustomization vnfResourceCust;
71 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
72 @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID", updatable = false, insertable = false)
73 private InstanceGroup instanceGroup;
75 @Column(name = "FUNCTION")
76 private String function;
78 @Column(name = "DESCRIPTION")
79 private String description;
81 @Column(name = "CREATION_TIMESTAMP", updatable = false)
82 @Temporal(TemporalType.TIMESTAMP)
86 public boolean equals(final Object other) {
87 if (!(other instanceof VnfcInstanceGroupCustomization)) {
90 VnfcInstanceGroupCustomization castOther = (VnfcInstanceGroupCustomization) other;
91 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID)
92 .append(modelUUID, castOther.modelUUID).isEquals();
96 public int hashCode() {
97 return new HashCodeBuilder().append(modelCustomizationUUID).append(modelUUID).toHashCode();
101 public String toString() {
102 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
103 .append("modelUUID", modelUUID).append("function", function).append("description", description)
104 .append("created", created).toString();
108 protected void onCreate() {
109 this.created = new Date();
112 public Date getCreated() {
116 public String getModelCustomizationUUID() {
117 return modelCustomizationUUID;
120 public void setModelCustomizationUUID(String modelCustomizationUUID) {
121 this.modelCustomizationUUID = modelCustomizationUUID;
124 public String getModelUUID() {
128 public void setModelUUID(String modelUUID) {
129 this.modelUUID = modelUUID;
132 public String getFunction() {
136 public void setFunction(String function) {
137 this.function = function;
140 public String getDescription() {
144 public void setDescription(String description) {
145 this.description = description;
148 public void setCreated(Date created) {
149 this.created = created;
153 public VnfResourceCustomization getVnfResourceCust() {
154 return vnfResourceCust;
157 public void setVnfResourceCust(VnfResourceCustomization vnfResourceCust) {
158 this.vnfResourceCust = vnfResourceCust;
162 public InstanceGroup getInstanceGroup() {
163 return instanceGroup;
166 public void setInstanceGroup(InstanceGroup instanceGroup) {
167 this.instanceGroup = instanceGroup;