1e3b6fc220c6faf3bb7a7eb42dd7ed96eae36463
[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         @Column(name = "RESOURCE_INPUT")
103         private String resourceInput;
104
105         @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
106         @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID")
107         private NetworkResource networkResource = null;
108
109         @PrePersist
110         protected void onCreate() {
111                 this.created = new Date();
112         }
113
114         public String getModelCustomizationUUID() {
115                 return this.modelCustomizationUUID;
116         }
117
118         public void setModelCustomizationUUID(String modelCustomizationUUID) {
119                 this.modelCustomizationUUID = modelCustomizationUUID;
120         }
121
122         public String getModelInstanceName() {
123                 return this.modelInstanceName;
124         }
125
126         public void setModelInstanceName(String modelInstanceName) {
127                 this.modelInstanceName = modelInstanceName;
128         }
129
130         @LinkedResource
131         public NetworkResource getNetworkResource() {
132                 return this.networkResource;
133         }
134
135         public void setNetworkResource(NetworkResource networkResource) {
136                 this.networkResource = networkResource;
137         }
138
139         public String getNetworkType() {
140                 return this.networkType;
141         }
142
143         public void setNetworkType(String networkType) {
144                 this.networkType = networkType;
145         }
146
147         public Date getCreated() {
148                 return this.created;
149         }
150
151         public String getNetworkTechnology() {
152                 return this.networkTechnology;
153         }
154
155         public void setNetworkTechnology(String networkTechnology) {
156                 this.networkTechnology = networkTechnology;
157         }
158
159         public String getNetworkScope() {
160                 return this.networkScope;
161         }
162
163         public void setNetworkScope(String networkScope) {
164                 this.networkScope = networkScope;
165         }
166
167         public void setNetworkRole(String networkRole) {
168                 this.networkRole = networkRole;
169         }
170
171         public String getNetworkRole() {
172                 return this.networkRole;
173         }
174
175         public String getResourceInput() {
176                 return resourceInput;
177         }
178
179         public void setResourceInput(String resourceInput) {
180                 this.resourceInput = resourceInput;
181         }
182 }