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