SO CDS Metadata ingestion
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / PnfResourceCustomization.java
1 /*
2  * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
3  * Foundation. ================================================================================ Licensed under the
4  * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
5  * obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
8  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
9  * either express or implied. See the License for the specific language governing permissions and limitations under the
10  * License.
11  *
12  * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
13  */
14
15 package org.onap.so.db.catalog.beans;
16
17 import com.fasterxml.jackson.annotation.JsonFormat;
18 import com.openpojo.business.annotation.BusinessKey;
19 import java.io.Serializable;
20 import java.util.Date;
21 import javax.persistence.CascadeType;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.Id;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.ManyToOne;
27 import javax.persistence.PrePersist;
28 import javax.persistence.Table;
29 import javax.persistence.Temporal;
30 import javax.persistence.TemporalType;
31 import org.apache.commons.lang3.builder.EqualsBuilder;
32 import org.apache.commons.lang3.builder.HashCodeBuilder;
33 import org.apache.commons.lang3.builder.ToStringBuilder;
34 import uk.co.blackpepper.bowman.annotation.LinkedResource;
35
36 @Entity
37 @Table(name = "pnf_resource_customization")
38 public class PnfResourceCustomization implements Serializable {
39
40     private static final long serialVersionUID = 768026109321305415L;
41
42     @BusinessKey
43     @Id
44     @Column(name = "MODEL_CUSTOMIZATION_UUID")
45     private String modelCustomizationUUID;
46
47     @Column(name = "MODEL_INSTANCE_NAME")
48     private String modelInstanceName;
49
50     @Column(name = "CREATION_TIMESTAMP", updatable = false)
51     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
52     @Temporal(TemporalType.TIMESTAMP)
53     private Date created;
54
55     @Column(name = "NF_FUNCTION")
56     private String nfFunction;
57
58     @Column(name = "NF_TYPE")
59     private String nfType;
60
61     @Column(name = "NF_ROLE")
62     private String nfRole;
63
64     @Column(name = "NF_NAMING_CODE")
65     private String nfNamingCode;
66
67     @Column(name = "MULTI_STAGE_DESIGN")
68     private String multiStageDesign;
69
70     @Column(name = "RESOURCE_INPUT")
71     private String resourceInput;
72
73     @ManyToOne(cascade = CascadeType.ALL)
74     @JoinColumn(name = "PNF_RESOURCE_MODEL_UUID")
75     private PnfResource pnfResources;
76
77     @Column(name = "CDS_BLUEPRINT_NAME")
78     private String blueprintName;
79
80     @Column(name = "CDS_BLUEPRINT_VERSION")
81     private String blueprintVersion;
82
83     @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
84     private Boolean skipPostInstConf;
85
86     @Column(name = "CONTROLLER_ACTOR")
87     private String controllerActor;
88
89     @Override
90     public String toString() {
91         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
92                 .append("modelInstanceName", modelInstanceName).append("created", created)
93                 .append("nfFunction", nfFunction).append("nfType", nfType).append("nfRole", nfRole)
94                 .append("nfNamingCode", nfNamingCode).append("multiStageDesign", multiStageDesign)
95                 .append("pnfResources", pnfResources).append("blueprintName", blueprintName)
96                 .append("blueprintVersion", blueprintVersion).append("controllerActor", controllerActor).toString();
97     }
98
99     @Override
100     public boolean equals(final Object other) {
101         if (!(other instanceof PnfResourceCustomization)) {
102             return false;
103         }
104         PnfResourceCustomization castOther = (PnfResourceCustomization) other;
105         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
106     }
107
108     @Override
109     public int hashCode() {
110         return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
111     }
112
113     @PrePersist
114     protected void onCreate() {
115         this.created = new Date();
116     }
117
118     public Date getCreationTimestamp() {
119         return this.created;
120     }
121
122     public void setCreated(Date created) {
123         this.created = created;
124     }
125
126     public String getModelCustomizationUUID() {
127         return modelCustomizationUUID;
128     }
129
130     public void setModelCustomizationUUID(String modelCustomizationUUID) {
131         this.modelCustomizationUUID = modelCustomizationUUID;
132     }
133
134     public String getModelInstanceName() {
135         return this.modelInstanceName;
136     }
137
138     public void setModelInstanceName(String modelInstanceName) {
139         this.modelInstanceName = modelInstanceName;
140     }
141
142     public String getNfFunction() {
143         return nfFunction;
144     }
145
146     public void setNfFunction(String nfFunction) {
147         this.nfFunction = nfFunction;
148     }
149
150     public String getNfType() {
151         return nfType;
152     }
153
154     public void setNfType(String nfType) {
155         this.nfType = nfType;
156     }
157
158     public String getNfRole() {
159         return nfRole;
160     }
161
162     public void setNfRole(String nfRole) {
163         this.nfRole = nfRole;
164     }
165
166     public String getNfNamingCode() {
167         return nfNamingCode;
168     }
169
170     public void setNfNamingCode(String nfNamingCode) {
171         this.nfNamingCode = nfNamingCode;
172     }
173
174     public String getMultiStageDesign() {
175         return this.multiStageDesign;
176     }
177
178     public void setMultiStageDesign(String multiStageDesign) {
179         this.multiStageDesign = multiStageDesign;
180     }
181
182     @LinkedResource
183     public PnfResource getPnfResources() {
184         return pnfResources;
185     }
186
187     public void setPnfResources(PnfResource pnfResources) {
188         this.pnfResources = pnfResources;
189     }
190
191     public Date getCreated() {
192         return created;
193     }
194
195     public String getResourceInput() {
196         return resourceInput;
197     }
198
199     public void setResourceInput(String resourceInput) {
200         this.resourceInput = resourceInput;
201     }
202
203
204     public String getBlueprintName() {
205         return blueprintName;
206     }
207
208     public void setBlueprintName(String blueprintName) {
209         this.blueprintName = blueprintName;
210     }
211
212     public String getBlueprintVersion() {
213         return blueprintVersion;
214     }
215
216     public void setBlueprintVersion(String blueprintVersion) {
217         this.blueprintVersion = blueprintVersion;
218     }
219
220     public Boolean isSkipPostInstConf() {
221         return skipPostInstConf;
222     }
223
224     public void setSkipPostInstConf(Boolean skipPostInstConf) {
225         this.skipPostInstConf = skipPostInstConf;
226     }
227
228     public String getControllerActor() {
229         return controllerActor;
230     }
231
232     public void setControllerActor(String controllerActor) {
233         this.controllerActor = controllerActor;
234     }
235 }