Containerization feature of SO
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / NetworkResourceCustomization.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
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.FetchType;
30 import javax.persistence.Id;
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
38 import org.apache.commons.lang3.builder.EqualsBuilder;
39 import org.apache.commons.lang3.builder.HashCodeBuilder;
40 import org.apache.commons.lang3.builder.ToStringBuilder;
41
42 import com.openpojo.business.annotation.BusinessKey;
43
44 import uk.co.blackpepper.bowman.annotation.LinkedResource;
45
46 @Entity
47 @Table(name = "network_resource_customization")
48 public class NetworkResourceCustomization implements Serializable {
49         public static final long serialVersionUID = -1322322139926390329L;
50
51         @Override
52         public String toString() {
53                 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
54                                 .append("modelInstanceName", modelInstanceName).append("created", created)
55                                 .append("networkTechnology", networkTechnology).append("networkType", networkType)
56                                 .append("networkScope", networkScope).append("networkRole", networkRole)
57                                 .append("networkResource", networkResource).toString();
58         }
59
60         @Override
61         public boolean equals(final Object other) {
62                 if (!(other instanceof NetworkResourceCustomization)) {
63                         return false;
64                 }
65                 NetworkResourceCustomization castOther = (NetworkResourceCustomization) other;
66                 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
67         }
68
69         @Override
70         public int hashCode() {
71                 return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
72         }
73
74         public NetworkResourceCustomization() {
75                 super();
76         }
77
78         @BusinessKey
79         @Id
80         @Column(name = "MODEL_CUSTOMIZATION_UUID")
81         private String modelCustomizationUUID = null;
82
83         @Column(name = "MODEL_INSTANCE_NAME")
84         private String modelInstanceName;
85
86         @Column(name = "CREATION_TIMESTAMP", updatable = false)
87         @Temporal(TemporalType.TIMESTAMP)
88         private Date created;
89
90         @Column(name = "NETWORK_TECHNOLOGY")
91         private String networkTechnology;
92
93         @Column(name = "NETWORK_TYPE")
94         private String networkType = null;
95
96         @Column(name = "NETWORK_SCOPE")
97         private String networkScope;
98
99         @Column(name = "NETWORK_ROLE")
100         private String networkRole;
101
102         @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
103         @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID")
104         private NetworkResource networkResource = null;
105
106         @PrePersist
107         protected void onCreate() {
108                 this.created = new Date();
109         }
110
111         public String getModelCustomizationUUID() {
112                 return this.modelCustomizationUUID;
113         }
114
115         public void setModelCustomizationUUID(String modelCustomizationUUID) {
116                 this.modelCustomizationUUID = modelCustomizationUUID;
117         }
118
119         public String getModelInstanceName() {
120                 return this.modelInstanceName;
121         }
122
123         public void setModelInstanceName(String modelInstanceName) {
124                 this.modelInstanceName = modelInstanceName;
125         }
126
127         @LinkedResource
128         public NetworkResource getNetworkResource() {
129                 return this.networkResource;
130         }
131
132         public void setNetworkResource(NetworkResource networkResource) {
133                 this.networkResource = networkResource;
134         }
135
136         public String getNetworkType() {
137                 return this.networkType;
138         }
139
140         public void setNetworkType(String networkType) {
141                 this.networkType = networkType;
142         }
143
144         public Date getCreated() {
145                 return this.created;
146         }
147
148         public String getNetworkTechnology() {
149                 return this.networkTechnology;
150         }
151
152         public void setNetworkTechnology(String networkTechnology) {
153                 this.networkTechnology = networkTechnology;
154         }
155
156         public String getNetworkScope() {
157                 return this.networkScope;
158         }
159
160         public void setNetworkScope(String networkScope) {
161                 this.networkScope = networkScope;
162         }
163
164         public void setNetworkRole(String networkRole) {
165                 this.networkRole = networkRole;
166         }
167
168         public String getNetworkRole() {
169                 return this.networkRole;
170         }
171 }