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