[SO] Release so 1.13.0 image
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / VnfcCustomization.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright (C) 2019 Huawei Intellectual Property. All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.so.db.catalog.beans;
23
24 import com.fasterxml.jackson.annotation.JsonFormat;
25 import com.openpojo.business.annotation.BusinessKey;
26 import org.apache.commons.lang3.builder.EqualsBuilder;
27 import org.apache.commons.lang3.builder.HashCodeBuilder;
28 import org.apache.commons.lang3.builder.ToStringBuilder;
29 import javax.persistence.CascadeType;
30 import javax.persistence.Column;
31 import javax.persistence.Entity;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.ManyToOne;
35 import javax.persistence.OneToMany;
36 import javax.persistence.PrePersist;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40 import java.io.Serializable;
41 import java.util.Date;
42 import java.util.List;
43 import uk.co.blackpepper.bowman.annotation.RemoteResource;
44
45 @Entity
46 @RemoteResource("/vnfcCustomization")
47 @Table(name = "vnfc_customization")
48 public class VnfcCustomization implements Serializable {
49
50     private static final long serialVersionUID = -3772469944364616486L;
51
52     @BusinessKey
53     @Id
54     @Column(name = "MODEL_CUSTOMIZATION_UUID")
55     private String modelCustomizationUUID;
56
57     @Column(name = "MODEL_INSTANCE_NAME")
58     private String modelInstanceName;
59
60     @Column(name = "MODEL_UUID")
61     private String modelUUID;
62
63     @Column(name = "MODEL_INVARIANT_UUID")
64     private String modelInvariantUUID;
65
66     @Column(name = "MODEL_VERSION")
67     private String modelVersion;
68
69     @Column(name = "MODEL_NAME")
70     private String modelName;
71
72     @Column(name = "TOSCA_NODE_TYPE")
73     private String toscaNodeType;
74
75     @Column(name = "DESCRIPTION")
76     private String description;
77
78     @Column(name = "RESOURCE_INPUT")
79     private String resourceInput;
80
81     @Column(name = "CREATION_TIMESTAMP", updatable = false)
82     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
83     @Temporal(TemporalType.TIMESTAMP)
84     private Date created;
85
86     @OneToMany(cascade = CascadeType.ALL, mappedBy = "vnfcCustomization")
87     private List<CvnfcCustomization> cvnfcCustomization;
88
89     @ManyToOne(cascade = CascadeType.ALL)
90     @JoinColumn(name = "VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID")
91     private VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization;
92
93     @Override
94     public boolean equals(final Object other) {
95         if (!(other instanceof VnfcCustomization)) {
96             return false;
97         }
98         VnfcCustomization castOther = (VnfcCustomization) other;
99         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
100     }
101
102     @Override
103     public int hashCode() {
104         return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
105     }
106
107     @Override
108     public String toString() {
109         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
110                 .append("modelInstanceName", modelInstanceName).append("modelUUID", modelUUID)
111                 .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion)
112                 .append("modelName", modelName).append("toscaNodeType", toscaNodeType)
113                 .append("description", description).append("created", created)
114                 .append("cvnfcCustomization", cvnfcCustomization).toString();
115     }
116
117     @PrePersist
118     protected void onCreate() {
119         this.created = new Date();
120     }
121
122     public String getModelCustomizationUUID() {
123         return modelCustomizationUUID;
124     }
125
126     public void setModelCustomizationUUID(String modelCustomizationUUID) {
127         this.modelCustomizationUUID = modelCustomizationUUID;
128     }
129
130     public String getModelInstanceName() {
131         return modelInstanceName;
132     }
133
134     public void setModelInstanceName(String modelInstanceName) {
135         this.modelInstanceName = modelInstanceName;
136     }
137
138     public String getModelUUID() {
139         return modelUUID;
140     }
141
142     public void setModelUUID(String modelUUID) {
143         this.modelUUID = modelUUID;
144     }
145
146     public String getModelInvariantUUID() {
147         return modelInvariantUUID;
148     }
149
150     public void setModelInvariantUUID(String modelInvariantUUID) {
151         this.modelInvariantUUID = modelInvariantUUID;
152     }
153
154     public String getModelVersion() {
155         return modelVersion;
156     }
157
158     public void setModelVersion(String modelVersion) {
159         this.modelVersion = modelVersion;
160     }
161
162     public String getModelName() {
163         return modelName;
164     }
165
166     public void setModelName(String modelName) {
167         this.modelName = modelName;
168     }
169
170     public String getToscaNodeType() {
171         return toscaNodeType;
172     }
173
174     public void setToscaNodeType(String toscaNodeType) {
175         this.toscaNodeType = toscaNodeType;
176     }
177
178     public String getDescription() {
179         return description;
180     }
181
182     public void setDescription(String description) {
183         this.description = description;
184     }
185
186     public Date getCreated() {
187         return created;
188     }
189
190     public void setCreated(Date created) {
191         this.created = created;
192     }
193
194     public List<CvnfcCustomization> getCvnfcCustomization() {
195         return cvnfcCustomization;
196     }
197
198     public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
199         this.cvnfcCustomization = cvnfcCustomization;
200     }
201
202     public VnfcInstanceGroupCustomization getVnfcInstanceGroupCustomization() {
203         return vnfcInstanceGroupCustomization;
204     }
205
206     public void setVnfcInstanceGroupCustomization(VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization) {
207         this.vnfcInstanceGroupCustomization = vnfcInstanceGroupCustomization;
208     }
209
210     public String getResourceInput() {
211         return resourceInput;
212     }
213
214     public void setResourceInput(String resourceInput) {
215         this.resourceInput = resourceInput;
216     }
217 }