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