Merge "Add Java OofClient"
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / VnfVfmoduleCvnfcConfigurationCustomization.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.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.ManyToOne;
35 import javax.persistence.PrePersist;
36 import javax.persistence.Table;
37 import javax.persistence.Temporal;
38 import javax.persistence.TemporalType;
39
40 import org.apache.commons.lang3.builder.EqualsBuilder;
41 import org.apache.commons.lang3.builder.HashCodeBuilder;
42 import org.apache.commons.lang3.builder.ToStringBuilder;
43
44 import com.fasterxml.jackson.annotation.JsonFormat;
45 import com.openpojo.business.annotation.BusinessKey;
46
47 @Entity
48 @Table(name = "vnf_vfmodule_cvnfc_configuration_customization")
49 public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable {
50
51         private static final long serialVersionUID = -3153216266280581103L;
52
53         @Id
54         @Column(name = "ID")
55         @GeneratedValue(strategy = GenerationType.IDENTITY)
56         private Integer id;
57         
58         @BusinessKey
59         @Column(name = "MODEL_CUSTOMIZATION_UUID")
60         private String modelCustomizationUUID;
61         
62         @Column(name = "MODEL_INSTANCE_NAME")
63         private String modelInstanceName;       
64         
65         @Column(name = "CONFIGURATION_TYPE")
66         private String configurationType;       
67         
68         @Column(name = "CONFIGURATION_ROLE")
69         private String configurationRole;       
70
71         @Column(name = "CONFIGURATION_FUNCTION")
72         private String configurationFunction;   
73
74         @Column(name = "POLICY_NAME")
75         private String policyName;      
76         
77         @Column(name = "CREATION_TIMESTAMP", updatable = false)
78         @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
79         @Temporal(TemporalType.TIMESTAMP)
80         private Date created;
81         
82         @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
83         @JoinColumn(name = "CONFIGURATION_MODEL_UUID")
84         private ConfigurationResource configurationResource;
85         
86         @BusinessKey
87         @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
88         @JoinColumn(name = "CVNFC_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID")
89         private CvnfcCustomization cvnfcCustomization;
90         
91         @BusinessKey
92         @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
93         @JoinColumn(name = "VF_MODULE_MODEL_CUSTOMIZATION_UUID")
94         private VfModuleCustomization vfModuleCustomization;
95
96         @BusinessKey
97         @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
98         @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID")
99         private VnfResourceCustomization vnfResourceCustomization;
100
101         @Override
102         public boolean equals(final Object other) {
103                 if (!(other instanceof VnfVfmoduleCvnfcConfigurationCustomization)) {
104                         return false;
105                 }
106                 VnfVfmoduleCvnfcConfigurationCustomization castOther = (VnfVfmoduleCvnfcConfigurationCustomization) other;
107                 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID)
108                                 .append(cvnfcCustomization, castOther.cvnfcCustomization)
109                                 .append(vfModuleCustomization, castOther.vfModuleCustomization)
110                                 .append(vnfResourceCustomization, castOther.vnfResourceCustomization).isEquals();
111         }
112
113
114
115         @Override
116         public int hashCode() {
117                 return new HashCodeBuilder().append(modelCustomizationUUID).append(cvnfcCustomization)
118                                 .append(vfModuleCustomization).append(vnfResourceCustomization).toHashCode();
119         }
120
121
122
123         @Override
124         public String toString() {
125                 return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID)
126                                 .append("modelInstanceName", modelInstanceName).append("configurationType", configurationType)
127                                 .append("configurationRole", configurationRole).append("configurationFunction", configurationFunction)
128                                 .append("policyName", policyName).append("created", created)
129                                 .append("configurationResource", configurationResource).append("cvnfcCustomization", cvnfcCustomization)
130                                 .append("vfModuleCustomization", vfModuleCustomization)
131                                 .append("vnfResourceCustomization", vnfResourceCustomization).toString();
132         }
133
134
135         
136         @PrePersist
137         protected void onCreate() {
138                 this.created = new Date();
139         }
140         
141         public Integer getId() {
142                 return id;
143         }
144
145         public void setId(Integer id) {
146                 this.id = id;
147         }
148
149         public String getModelCustomizationUUID() {
150                 return modelCustomizationUUID;
151         }
152
153         public void setModelCustomizationUUID(String modelCustomizationUUID) {
154                 this.modelCustomizationUUID = modelCustomizationUUID;
155         }
156
157         public String getModelInstanceName() {
158                 return modelInstanceName;
159         }
160
161         public void setModelInstanceName(String modelInstanceName) {
162                 this.modelInstanceName = modelInstanceName;
163         }
164
165         public String getConfigurationType() {
166                 return configurationType;
167         }
168
169         public void setConfigurationType(String configurationType) {
170                 this.configurationType = configurationType;
171         }
172
173         public String getConfigurationRole() {
174                 return configurationRole;
175         }
176
177         public void setConfigurationRole(String configurationRole) {
178                 this.configurationRole = configurationRole;
179         }
180
181         public String getConfigurationFunction() {
182                 return configurationFunction;
183         }
184
185         public void setConfigurationFunction(String configurationFunction) {
186                 this.configurationFunction = configurationFunction;
187         }
188
189         public String getPolicyName() {
190                 return policyName;
191         }
192
193         public void setPolicyName(String policyName) {
194                 this.policyName = policyName;
195         }
196
197         public Date getCreated() {
198                 return created;
199         }
200
201         public void setCreated(Date created) {
202                 this.created = created;
203         }
204
205         public ConfigurationResource getConfigurationResource() {
206                 return configurationResource;
207         }
208
209         public void setConfigurationResource(ConfigurationResource configurationResource) {
210                 this.configurationResource = configurationResource;
211         }
212
213         public CvnfcCustomization getCvnfcCustomization() {
214                 return cvnfcCustomization;
215         }
216
217         public void setCvnfcCustomization(CvnfcCustomization cvnfcCustomization) {
218                 this.cvnfcCustomization = cvnfcCustomization;
219         }
220
221         public VfModuleCustomization getVfModuleCustomization() {
222                 return vfModuleCustomization;
223         }
224
225         public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) {
226                 this.vfModuleCustomization = vfModuleCustomization;
227         }
228
229         public VnfResourceCustomization getVnfResourceCustomization() {
230                 return vnfResourceCustomization;
231         }
232
233         public void setVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) {
234                 this.vnfResourceCustomization = vnfResourceCustomization;
235         }
236 }