[SO] Release so 1.13.0 image
[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 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 com.fasterxml.jackson.annotation.JsonFormat;
37 import org.apache.commons.lang3.builder.EqualsBuilder;
38 import org.apache.commons.lang3.builder.HashCodeBuilder;
39 import org.apache.commons.lang3.builder.ToStringBuilder;
40 import com.openpojo.business.annotation.BusinessKey;
41 import uk.co.blackpepper.bowman.annotation.LinkedResource;
42 import uk.co.blackpepper.bowman.annotation.RemoteResource;
43
44 @Entity
45 @RemoteResource("/allottedResourceCustomization")
46 @Table(name = "allotted_resource_customization")
47 public class AllottedResourceCustomization implements Serializable {
48
49     private static final long serialVersionUID = 768026109321305392L;
50
51     @BusinessKey
52     @Id
53     @Column(name = "MODEL_CUSTOMIZATION_UUID")
54     private String modelCustomizationUUID;
55
56     @Column(name = "CREATION_TIMESTAMP", updatable = false)
57     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
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     @Column(name = "RESOURCE_INPUT")
95     private String resourceInput;
96
97     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
98     @JoinColumn(name = "AR_MODEL_UUID")
99     private AllottedResource allottedResource;
100
101     @Override
102     public String toString() {
103         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
104                 .append("created", created).append("modelInstanceName", modelInstanceName)
105                 .append("providingServiceModelInvariantUUID", providingServiceModelInvariantUUID)
106                 .append("providingServiceModelUUID", providingServiceModelUUID)
107                 .append("providingServiceModelName", providingServiceModelName)
108                 .append("targetNetworkRole", targetNetworkRole).append("nfFunction", nfFunction)
109                 .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
110                 .append("minInstances", minInstances).append("maxInstances", maxInstances)
111                 .append("allottedResource", allottedResource).toString();
112     }
113
114     @PrePersist
115     protected void onCreate() {
116         this.created = new Date();
117     }
118
119     @Override
120     public boolean equals(final Object other) {
121         if (!(other instanceof AllottedResourceCustomization)) {
122             return false;
123         }
124         AllottedResourceCustomization castOther = (AllottedResourceCustomization) other;
125         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
126     }
127
128     @Override
129     public int hashCode() {
130         return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
131     }
132
133     public String getProvidingServiceModelUUID() {
134         return providingServiceModelUUID;
135     }
136
137     public void setProvidingServiceModelUUID(String providingServiceModelUUID) {
138         this.providingServiceModelUUID = providingServiceModelUUID;
139     }
140
141     public String getProvidingServiceModelName() {
142         return providingServiceModelName;
143     }
144
145     public void setProvidingServiceModelName(String providingServiceModelName) {
146         this.providingServiceModelName = providingServiceModelName;
147     }
148
149     public AllottedResourceCustomization() {
150         super();
151     }
152
153     public String getModelCustomizationUUID() {
154         return this.modelCustomizationUUID;
155     }
156
157     public void setModelCustomizationUUID(String modelCustomizationUUID) {
158         this.modelCustomizationUUID = modelCustomizationUUID;
159     }
160
161     public Date getCreated() {
162         return this.created;
163     }
164
165     public String getModelInstanceName() {
166         return this.modelInstanceName;
167     }
168
169     public void setModelInstanceName(String modelInstanceName) {
170         this.modelInstanceName = modelInstanceName;
171     }
172
173     @LinkedResource
174     public AllottedResource getAllottedResource() {
175         return this.allottedResource;
176     }
177
178     public void setAllottedResource(AllottedResource allottedResource) {
179         this.allottedResource = allottedResource;
180     }
181
182     public String getProvidingServiceModelInvariantUUID() {
183         return this.providingServiceModelInvariantUUID;
184     }
185
186     public void setProvidingServiceModelInvariantUUID(String providingServiceModelInvariantUUID) {
187         this.providingServiceModelInvariantUUID = providingServiceModelInvariantUUID;
188     }
189
190     public String getTargetNetworkRole() {
191         return this.targetNetworkRole;
192     }
193
194     public void setTargetNetworkRole(String targetNetworkRole) {
195         this.targetNetworkRole = targetNetworkRole;
196     }
197
198     public String getNfFunction() {
199         return this.nfFunction;
200     }
201
202     public void setNfFunction(String nfFunction) {
203         this.nfFunction = nfFunction;
204     }
205
206     public String getNfType() {
207         return this.nfType;
208     }
209
210     public void setNfType(String nfType) {
211         this.nfType = nfType;
212     }
213
214     public String getNfRole() {
215         return this.nfRole;
216     }
217
218     public void setNfRole(String nfRole) {
219         this.nfRole = nfRole;
220     }
221
222     public String getNfNamingCode() {
223         return this.nfNamingCode;
224     }
225
226     public void setNfNamingCode(String nfNamingCode) {
227         this.nfNamingCode = nfNamingCode;
228     }
229
230     public Integer getMinInstances() {
231         return this.minInstances;
232     }
233
234     public void setMinInstances(Integer minInstances) {
235         this.minInstances = minInstances;
236     }
237
238     public Integer getMaxInstances() {
239         return this.maxInstances;
240     }
241
242     public void setMaxInstances(Integer maxInstances) {
243         this.maxInstances = maxInstances;
244     }
245
246     public String getResourceInput() {
247         return resourceInput;
248     }
249
250     public void setResourceInput(String resourceInput) {
251         this.resourceInput = resourceInput;
252     }
253 }