2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.so.db.catalog.beans;
24 import java.io.Serializable;
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.FetchType;
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 com.openpojo.business.annotation.BusinessKey;
45 import uk.co.blackpepper.bowman.annotation.LinkedResource;
46 import uk.co.blackpepper.bowman.annotation.RemoteResource;
49 @RemoteResource("/vnfcInstanceGroupCustomization")
51 @Table(name = "vnfc_instance_group_customization")
52 public class VnfcInstanceGroupCustomization implements Serializable {
57 private static final long serialVersionUID = -8288218040186901676L;
62 @GeneratedValue(strategy = GenerationType.IDENTITY)
65 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
66 @JoinColumn(name = "VNF_RESOURCE_CUSTOMIZATION_ID")
67 private VnfResourceCustomization vnfResourceCust;
69 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
70 @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID")
71 private InstanceGroup instanceGroup;
73 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "vnfcInstanceGroupCustomization")
74 private List<VnfcCustomization> vnfcCustomizations;
76 @Column(name = "FUNCTION")
77 private String function;
79 @Column(name = "DESCRIPTION")
80 private String description;
82 @Column(name = "CREATION_TIMESTAMP", updatable = false)
83 @Temporal(TemporalType.TIMESTAMP)
87 public boolean equals(final Object other) {
88 if (!(other instanceof VnfcInstanceGroupCustomization)) {
91 VnfcInstanceGroupCustomization castOther = (VnfcInstanceGroupCustomization) other;
92 return new EqualsBuilder().append(id, castOther.id).isEquals();
96 public int hashCode() {
97 return new HashCodeBuilder().append(id).toHashCode();
101 public String toString() {
102 return new ToStringBuilder(this).append("function", function).append("description", description)
103 .append("created", created).toString();
106 public Integer getId() {
110 public void setId(Integer id) {
115 protected void onCreate() {
116 this.created = new Date();
119 public Date getCreated() {
123 public String getFunction() {
127 public void setFunction(String function) {
128 this.function = function;
131 public String getDescription() {
135 public void setDescription(String description) {
136 this.description = description;
139 public void setCreated(Date created) {
140 this.created = created;
144 public VnfResourceCustomization getVnfResourceCust() {
145 return vnfResourceCust;
148 public void setVnfResourceCust(VnfResourceCustomization vnfResourceCust) {
149 this.vnfResourceCust = vnfResourceCust;
153 public InstanceGroup getInstanceGroup() {
154 return instanceGroup;
157 public void setInstanceGroup(InstanceGroup instanceGroup) {
158 this.instanceGroup = instanceGroup;
161 public List<VnfcCustomization> getVnfcCustomizations() {
162 return vnfcCustomizations;
165 public void setVnfcCustomizations(List<VnfcCustomization> vnfcCustomizations) {
166 this.vnfcCustomizations = vnfcCustomizations;