Containerization feature of SO
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / AllottedResourceCustomization.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 = "allotted_resource_customization")
48 public class AllottedResourceCustomization implements Serializable {
49
50         private static final long serialVersionUID = 768026109321305392L;
51
52         @BusinessKey
53         @Id
54         @Column(name = "MODEL_CUSTOMIZATION_UUID")
55         private String modelCustomizationUUID;
56
57         @Column(name = "CREATION_TIMESTAMP", updatable = false)
58         @Temporal(TemporalType.TIMESTAMP)
59         private Date created;
60
61         @Column(name = "MODEL_INSTANCE_NAME")
62         private String modelInstanceName;
63
64         @Column(name = "PROVIDING_SERVICE_MODEL_INVARIANT_UUID")
65         private String providingServiceModelInvariantUUID;
66
67         @Column(name = "PROVIDING_SERVICE_MODEL_UUID")
68         private String providingServiceModelUUID;
69
70         @Column(name = "PROVIDING_SERVICE_MODEL_NAME")
71         private String providingServiceModelName;
72
73         @Column(name = "TARGET_NETWORK_ROLE")
74         private String targetNetworkRole;
75
76         @Column(name = "NF_FUNCTION")
77         private String nfFunction;
78
79         @Column(name = "NF_TYPE")
80         private String nfType;
81
82         @Column(name = "NF_ROLE")
83         private String nfRole;
84
85         @Column(name = "NF_NAMING_CODE")
86         private String nfNamingCode;
87
88         @Column(name = "MIN_INSTANCES")
89         private Integer minInstances;
90
91         @Column(name = "MAX_INSTANCES")
92         private Integer maxInstances;
93
94         @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
95         @JoinColumn(name = "AR_MODEL_UUID")
96         private AllottedResource allottedResource;
97
98         @Override
99         public String toString() {
100                 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
101                                 .append("created", created).append("modelInstanceName", modelInstanceName)
102                                 .append("providingServiceModelInvariantUUID", providingServiceModelInvariantUUID)
103                                 .append("providingServiceModelUUID", providingServiceModelUUID)
104                                 .append("providingServiceModelName", providingServiceModelName)
105                                 .append("targetNetworkRole", targetNetworkRole).append("nfFunction", nfFunction)
106                                 .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
107                                 .append("minInstances", minInstances).append("maxInstances", maxInstances)
108                                 .append("allottedResource", allottedResource).toString();
109         }
110
111         @PrePersist
112         protected void onCreate() {
113                 this.created = new Date();
114         }
115
116         @Override
117         public boolean equals(final Object other) {
118                 if (!(other instanceof AllottedResourceCustomization)) {
119                         return false;
120                 }
121                 AllottedResourceCustomization castOther = (AllottedResourceCustomization) other;
122                 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
123         }
124
125         @Override
126         public int hashCode() {
127                 return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
128         }
129
130         public String getProvidingServiceModelUUID() {
131                 return providingServiceModelUUID;
132         }
133
134         public void setProvidingServiceModelUUID(String providingServiceModelUUID) {
135                 this.providingServiceModelUUID = providingServiceModelUUID;
136         }
137
138         public String getProvidingServiceModelName() {
139                 return providingServiceModelName;
140         }
141
142         public void setProvidingServiceModelName(String providingServiceModelName) {
143                 this.providingServiceModelName = providingServiceModelName;
144         }
145
146         public AllottedResourceCustomization() {
147                 super();
148         }
149
150         public String getModelCustomizationUUID() {
151                 return this.modelCustomizationUUID;
152         }
153
154         public void setModelCustomizationUUID(String modelCustomizationUUID) {
155                 this.modelCustomizationUUID = modelCustomizationUUID;
156         }
157
158         public Date getCreated() {
159                 return this.created;
160         }
161
162         public String getModelInstanceName() {
163                 return this.modelInstanceName;
164         }
165
166         public void setModelInstanceName(String modelInstanceName) {
167                 this.modelInstanceName = modelInstanceName;
168         }
169
170         @LinkedResource
171         public AllottedResource getAllottedResource() {
172                 return this.allottedResource;
173         }
174
175         public void setAllottedResource(AllottedResource allottedResource) {
176                 this.allottedResource = allottedResource;
177         }
178
179         public String getProvidingServiceModelInvariantUUID() {
180                 return this.providingServiceModelInvariantUUID;
181         }
182
183         public void setProvidingServiceModelInvariantUUID(String providingServiceModelInvariantUUID) {
184                 this.providingServiceModelInvariantUUID = providingServiceModelInvariantUUID;
185         }
186
187         public String getTargetNetworkRole() {
188                 return this.targetNetworkRole;
189         }
190
191         public void setTargetNetworkRole(String targetNetworkRole) {
192                 this.targetNetworkRole = targetNetworkRole;
193         }
194
195         public String getNfFunction() {
196                 return this.nfFunction;
197         }
198
199         public void setNfFunction(String nfFunction) {
200                 this.nfFunction = nfFunction;
201         }
202
203         public String getNfType() {
204                 return this.nfType;
205         }
206
207         public void setNfType(String nfType) {
208                 this.nfType = nfType;
209         }
210
211         public String getNfRole() {
212                 return this.nfRole;
213         }
214
215         public void setNfRole(String nfRole) {
216                 this.nfRole = nfRole;
217         }
218
219         public String getNfNamingCode() {
220                 return this.nfNamingCode;
221         }
222
223         public void setNfNamingCode(String nfNamingCode) {
224                 this.nfNamingCode = nfNamingCode;
225         }
226
227         public Integer getMinInstances() {
228                 return this.minInstances;
229         }
230
231         public void setMinInstances(Integer minInstances) {
232                 this.minInstances = minInstances;
233         }
234
235         public Integer getMaxInstances() {
236                 return this.maxInstances;
237         }
238
239         public void setMaxInstances(Integer maxInstances) {
240                 this.maxInstances = maxInstances;
241         }
242 }