Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / CollectionNetworkResourceCustomization.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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.JoinColumn;
31 import javax.persistence.ManyToOne;
32 import javax.persistence.PrePersist;
33 import javax.persistence.Table;
34 import javax.persistence.Temporal;
35 import javax.persistence.TemporalType;
36 import org.apache.commons.lang3.builder.EqualsBuilder;
37 import org.apache.commons.lang3.builder.HashCodeBuilder;
38 import org.apache.commons.lang3.builder.ToStringBuilder;
39 import com.openpojo.business.annotation.BusinessKey;
40 import uk.co.blackpepper.bowman.annotation.LinkedResource;
41
42 @Entity
43 @Table(name = "collection_network_resource_customization")
44 public class CollectionNetworkResourceCustomization implements Serializable {
45
46     /**
47      * 
48      */
49     private static final long serialVersionUID = 11115611315801079L;
50
51     @BusinessKey
52     @Id
53     @Column(name = "MODEL_CUSTOMIZATION_UUID")
54     private String modelCustomizationUUID = null;
55
56     @Column(name = "MODEL_INSTANCE_NAME")
57     private String modelInstanceName;
58
59     @Column(name = "CREATION_TIMESTAMP", updatable = false)
60     @Temporal(TemporalType.TIMESTAMP)
61     private Date created;
62
63     @BusinessKey
64     @Column(name = "NETWORK_TECHNOLOGY")
65     private String networkTechnology;
66
67     @BusinessKey
68     @Column(name = "NETWORK_TYPE")
69     private String networkType = null;
70
71     @BusinessKey
72     @Column(name = "NETWORK_SCOPE")
73     private String networkScope;
74
75     @BusinessKey
76     @Column(name = "NETWORK_ROLE")
77     private String networkRole;
78
79     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
80     @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID")
81     private NetworkResource networkResource = null;
82
83     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
84     @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID")
85     private InstanceGroup instanceGroup = null;
86
87     @BusinessKey
88     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
89     @JoinColumn(name = "CRC_MODEL_CUSTOMIZATION_UUID")
90     private NetworkCollectionResourceCustomization networkResourceCustomization = null;
91
92     @PrePersist
93     protected void onCreate() {
94         this.created = new Date();
95     }
96
97     @Override
98     public boolean equals(final Object other) {
99         if (!(other instanceof CollectionNetworkResourceCustomization)) {
100             return false;
101         }
102         CollectionNetworkResourceCustomization castOther = (CollectionNetworkResourceCustomization) other;
103         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID)
104                 .append(networkTechnology, castOther.networkTechnology).append(networkType, castOther.networkType)
105                 .append(networkScope, castOther.networkScope).append(networkRole, castOther.networkRole)
106                 .append(networkResourceCustomization, castOther.networkResourceCustomization).isEquals();
107     }
108
109     @Override
110     public int hashCode() {
111         return new HashCodeBuilder().append(modelCustomizationUUID).append(networkTechnology).append(networkType)
112                 .append(networkScope).append(networkRole).append(networkResourceCustomization).toHashCode();
113     }
114
115     @Override
116     public String toString() {
117         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
118                 .append("modelInstanceName", modelInstanceName).append("created", created)
119                 .append("networkTechnology", networkTechnology).append("networkType", networkType)
120                 .append("networkScope", networkScope).append("networkRole", networkRole)
121                 .append("networkResource", networkResource).append("collectionResource", networkResourceCustomization)
122                 .toString();
123     }
124
125     public String getModelCustomizationUUID() {
126         return this.modelCustomizationUUID;
127     }
128
129     public void setModelCustomizationUUID(String modelCustomizationUUID) {
130         this.modelCustomizationUUID = modelCustomizationUUID;
131     }
132
133     @LinkedResource
134     public NetworkCollectionResourceCustomization getNetworkResourceCustomization() {
135         return networkResourceCustomization;
136     }
137
138     public void setNetworkResourceCustomization(NetworkCollectionResourceCustomization networkResourceCustomization) {
139         this.networkResourceCustomization = networkResourceCustomization;
140     }
141
142     public String getModelInstanceName() {
143         return this.modelInstanceName;
144     }
145
146     public void setModelInstanceName(String modelInstanceName) {
147         this.modelInstanceName = modelInstanceName;
148     }
149
150     @LinkedResource
151     public NetworkResource getNetworkResource() {
152         return this.networkResource;
153     }
154
155     public void setNetworkResource(NetworkResource networkResource) {
156         this.networkResource = networkResource;
157     }
158
159     public String getNetworkType() {
160         return this.networkType;
161     }
162
163     public void setNetworkType(String networkType) {
164         this.networkType = networkType;
165     }
166
167     public Date getCreated() {
168         return this.created;
169     }
170
171     public String getNetworkTechnology() {
172         return this.networkTechnology;
173     }
174
175     public void setNetworkTechnology(String networkTechnology) {
176         this.networkTechnology = networkTechnology;
177     }
178
179     public String getNetworkScope() {
180         return this.networkScope;
181     }
182
183     public void setNetworkScope(String networkScope) {
184         this.networkScope = networkScope;
185     }
186
187     public void setNetworkRole(String networkRole) {
188         this.networkRole = networkRole;
189     }
190
191     public String getNetworkRole() {
192         return this.networkRole;
193     }
194
195     @LinkedResource
196     public InstanceGroup getInstanceGroup() {
197         return instanceGroup;
198     }
199
200     public void setInstanceGroup(InstanceGroup instanceGroup) {
201         this.instanceGroup = instanceGroup;
202     }
203
204 }