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;
25 import javax.persistence.CascadeType;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.FetchType;
29 import javax.persistence.Id;
30 import javax.persistence.IdClass;
31 import javax.persistence.JoinColumn;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.PrePersist;
34 import javax.persistence.Table;
35 import javax.persistence.Temporal;
36 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;
40 import com.openpojo.business.annotation.BusinessKey;
41 import uk.co.blackpepper.bowman.annotation.LinkedResource;
42 import uk.co.blackpepper.bowman.annotation.RemoteResource;
45 @RemoteResource("/collectionResourceInstanceGroupCustomization")
46 @IdClass(CollectionResourceInstanceGroupCustomizationId.class)
47 @Table(name = "collection_resource_instance_group_customization")
48 public class CollectionResourceInstanceGroupCustomization implements Serializable {
53 private static final long serialVersionUID = 5169990063225044265L;
57 @Column(name = "COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID")
58 private String modelCustomizationUUID;
62 @Column(name = "INSTANCE_GROUP_MODEL_UUID")
63 private String modelUUID;
66 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
67 @JoinColumn(name = "COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID", updatable = false, insertable = false)
68 private CollectionResourceCustomization collectionResourceCust;
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)
85 @Column(name = "SUBINTERFACE_NETWORK_QUANTITY")
86 private Integer subInterfaceNetworkQuantity;
89 public String toString() {
90 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
91 .append("modelUUID", modelUUID).append("collectionResourceCust", collectionResourceCust)
92 .append("instanceGroup", instanceGroup).append("function", function).append("description", description)
93 .append("created", created).append("subInterfaceNetworkQuantity", subInterfaceNetworkQuantity)
98 public boolean equals(final Object other) {
99 if (!(other instanceof CollectionResourceInstanceGroupCustomization)) {
102 CollectionResourceInstanceGroupCustomization castOther = (CollectionResourceInstanceGroupCustomization) other;
103 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID)
104 .append(modelUUID, castOther.modelUUID).append(collectionResourceCust, castOther.collectionResourceCust)
105 .append(instanceGroup, castOther.instanceGroup).isEquals();
109 public int hashCode() {
110 return new HashCodeBuilder().append(modelCustomizationUUID).append(modelUUID).append(collectionResourceCust)
111 .append(instanceGroup).toHashCode();
115 protected void onCreate() {
116 this.created = new Date();
119 public String getModelCustomizationUUID() {
120 return modelCustomizationUUID;
123 public void setModelCustomizationUUID(String modelCustomizationUUID) {
124 this.modelCustomizationUUID = modelCustomizationUUID;
127 public String getModelUUID() {
131 public void setModelUUID(String modelUUID) {
132 this.modelUUID = modelUUID;
135 public String getFunction() {
139 public void setFunction(String function) {
140 this.function = function;
143 public String getDescription() {
147 public void setDescription(String description) {
148 this.description = description;
151 public Date getCreated() {
155 public Integer getSubInterfaceNetworkQuantity() {
156 return subInterfaceNetworkQuantity;
159 public void setSubInterfaceNetworkQuantity(Integer subInterfaceNetworkQuantity) {
160 this.subInterfaceNetworkQuantity = subInterfaceNetworkQuantity;
164 public CollectionResourceCustomization getCollectionResourceCust() {
165 return collectionResourceCust;
168 public void setCollectionResourceCust(CollectionResourceCustomization collectionResourceCust) {
169 this.collectionResourceCust = collectionResourceCust;
173 public InstanceGroup getInstanceGroup() {
174 return instanceGroup;
177 public void setInstanceGroup(InstanceGroup instanceGroup) {
178 this.instanceGroup = instanceGroup;