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;
 
  44 @IdClass(CollectionResourceInstanceGroupCustomizationId.class)
 
  45 @Table(name = "collection_resource_instance_group_customization")
 
  46 public class CollectionResourceInstanceGroupCustomization implements Serializable {
 
  51     private static final long serialVersionUID = 5169990063225044265L;
 
  55     @Column(name = "COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID")
 
  56     private String modelCustomizationUUID;
 
  60     @Column(name = "INSTANCE_GROUP_MODEL_UUID")
 
  61     private String modelUUID;
 
  63     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
 
  64     @JoinColumn(name = "COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID", updatable = false, insertable = false)
 
  65     private CollectionResourceCustomization collectionResourceCust;
 
  67     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
 
  68     @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID", updatable = false, insertable = false)
 
  69     private InstanceGroup instanceGroup;
 
  71     @Column(name = "FUNCTION")
 
  72     private String function;
 
  74     @Column(name = "DESCRIPTION")
 
  75     private String description;
 
  77     @Column(name = "CREATION_TIMESTAMP", updatable = false)
 
  78     @Temporal(TemporalType.TIMESTAMP)
 
  81     @Column(name = "SUBINTERFACE_NETWORK_QUANTITY")
 
  82     private Integer subInterfaceNetworkQuantity;
 
  85     public String toString() {
 
  86         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
 
  87                 .append("modelUUID", modelUUID).append("collectionResourceCust", collectionResourceCust)
 
  88                 .append("instanceGroup", instanceGroup).append("function", function).append("description", description)
 
  89                 .append("created", created).append("subInterfaceNetworkQuantity", subInterfaceNetworkQuantity)
 
  94     public boolean equals(final Object other) {
 
  95         if (!(other instanceof CollectionResourceInstanceGroupCustomization)) {
 
  98         CollectionResourceInstanceGroupCustomization castOther = (CollectionResourceInstanceGroupCustomization) other;
 
  99         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID)
 
 100                 .append(modelUUID, castOther.modelUUID).append(collectionResourceCust, castOther.collectionResourceCust)
 
 101                 .append(instanceGroup, castOther.instanceGroup).isEquals();
 
 105     public int hashCode() {
 
 106         return new HashCodeBuilder().append(modelCustomizationUUID).append(modelUUID).append(collectionResourceCust)
 
 107                 .append(instanceGroup).toHashCode();
 
 111     protected void onCreate() {
 
 112         this.created = new Date();
 
 115     public String getModelCustomizationUUID() {
 
 116         return modelCustomizationUUID;
 
 119     public void setModelCustomizationUUID(String modelCustomizationUUID) {
 
 120         this.modelCustomizationUUID = modelCustomizationUUID;
 
 123     public String getModelUUID() {
 
 127     public void setModelUUID(String modelUUID) {
 
 128         this.modelUUID = modelUUID;
 
 131     public String getFunction() {
 
 135     public void setFunction(String function) {
 
 136         this.function = function;
 
 139     public String getDescription() {
 
 143     public void setDescription(String description) {
 
 144         this.description = description;
 
 147     public Date getCreated() {
 
 151     public Integer getSubInterfaceNetworkQuantity() {
 
 152         return subInterfaceNetworkQuantity;
 
 155     public void setSubInterfaceNetworkQuantity(Integer subInterfaceNetworkQuantity) {
 
 156         this.subInterfaceNetworkQuantity = subInterfaceNetworkQuantity;
 
 160     public CollectionResourceCustomization getCollectionResourceCust() {
 
 161         return collectionResourceCust;
 
 164     public void setCollectionResourceCust(CollectionResourceCustomization collectionResourceCust) {
 
 165         this.collectionResourceCust = collectionResourceCust;
 
 169     public InstanceGroup getInstanceGroup() {
 
 170         return instanceGroup;
 
 173     public void setInstanceGroup(InstanceGroup instanceGroup) {
 
 174         this.instanceGroup = instanceGroup;