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