Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / CollectionResourceInstanceGroupCustomization.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.db.catalog.beans;
22
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
43 @Entity
44 @IdClass(CollectionResourceInstanceGroupCustomizationId.class)
45 @Table(name = "collection_resource_instance_group_customization")
46 public class CollectionResourceInstanceGroupCustomization implements Serializable {
47
48     /**
49      * 
50      */
51     private static final long serialVersionUID = 5169990063225044265L;
52
53     @BusinessKey
54     @Id
55     @Column(name = "COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID")
56     private String modelCustomizationUUID;
57
58     @BusinessKey
59     @Id
60     @Column(name = "INSTANCE_GROUP_MODEL_UUID")
61     private String modelUUID;
62
63     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
64     @JoinColumn(name = "COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID", updatable = false, insertable = false)
65     private CollectionResourceCustomization collectionResourceCust;
66
67     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
68     @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID", updatable = false, insertable = false)
69     private InstanceGroup instanceGroup;
70
71     @Column(name = "FUNCTION")
72     private String function;
73
74     @Column(name = "DESCRIPTION")
75     private String description;
76
77     @Column(name = "CREATION_TIMESTAMP", updatable = false)
78     @Temporal(TemporalType.TIMESTAMP)
79     private Date created;
80
81     @Column(name = "SUBINTERFACE_NETWORK_QUANTITY")
82     private Integer subInterfaceNetworkQuantity;
83
84     @Override
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)
90                 .toString();
91     }
92
93     @Override
94     public boolean equals(final Object other) {
95         if (!(other instanceof CollectionResourceInstanceGroupCustomization)) {
96             return false;
97         }
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();
102     }
103
104     @Override
105     public int hashCode() {
106         return new HashCodeBuilder().append(modelCustomizationUUID).append(modelUUID).append(collectionResourceCust)
107                 .append(instanceGroup).toHashCode();
108     }
109
110     @PrePersist
111     protected void onCreate() {
112         this.created = new Date();
113     }
114
115     public String getModelCustomizationUUID() {
116         return modelCustomizationUUID;
117     }
118
119     public void setModelCustomizationUUID(String modelCustomizationUUID) {
120         this.modelCustomizationUUID = modelCustomizationUUID;
121     }
122
123     public String getModelUUID() {
124         return modelUUID;
125     }
126
127     public void setModelUUID(String modelUUID) {
128         this.modelUUID = modelUUID;
129     }
130
131     public String getFunction() {
132         return function;
133     }
134
135     public void setFunction(String function) {
136         this.function = function;
137     }
138
139     public String getDescription() {
140         return description;
141     }
142
143     public void setDescription(String description) {
144         this.description = description;
145     }
146
147     public Date getCreated() {
148         return created;
149     }
150
151     public Integer getSubInterfaceNetworkQuantity() {
152         return subInterfaceNetworkQuantity;
153     }
154
155     public void setSubInterfaceNetworkQuantity(Integer subInterfaceNetworkQuantity) {
156         this.subInterfaceNetworkQuantity = subInterfaceNetworkQuantity;
157     }
158
159     @LinkedResource
160     public CollectionResourceCustomization getCollectionResourceCust() {
161         return collectionResourceCust;
162     }
163
164     public void setCollectionResourceCust(CollectionResourceCustomization collectionResourceCust) {
165         this.collectionResourceCust = collectionResourceCust;
166     }
167
168     @LinkedResource
169     public InstanceGroup getInstanceGroup() {
170         return instanceGroup;
171     }
172
173     public void setInstanceGroup(InstanceGroup instanceGroup) {
174         this.instanceGroup = instanceGroup;
175     }
176 }