b2d40b8409da2e7ab9e436e1b0ddb82f9c272aa5
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / PnfResourceCustomization.java
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  *  ================================================================================
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  *
16  *  SPDX-License-Identifier: Apache-2.0
17  *  ============LICENSE_END=========================================================
18  */
19
20 package org.onap.so.db.catalog.beans;
21
22 import com.fasterxml.jackson.annotation.JsonFormat;
23 import com.openpojo.business.annotation.BusinessKey;
24 import java.io.Serializable;
25 import java.util.Date;
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
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 org.apache.commons.lang3.builder.EqualsBuilder;
37 import org.apache.commons.lang3.builder.HashCodeBuilder;
38 import org.apache.commons.lang3.builder.ToStringBuilder;
39 import uk.co.blackpepper.bowman.annotation.LinkedResource;
40
41 @Entity
42 @Table(name = "pnf_resource_customization")
43 public class PnfResourceCustomization implements Serializable {
44
45     private static final long serialVersionUID = 768026109321305415L;
46
47     @BusinessKey
48     @Id
49     @Column(name = "MODEL_CUSTOMIZATION_UUID")
50     private String modelCustomizationUUID;
51
52     @Column(name = "MODEL_INSTANCE_NAME")
53     private String modelInstanceName;
54
55     @Column(name = "CREATION_TIMESTAMP", updatable = false)
56     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
57     @Temporal(TemporalType.TIMESTAMP)
58     private Date created;
59
60     @Column(name = "NF_FUNCTION")
61     private String nfFunction;
62
63     @Column(name = "NF_TYPE")
64     private String nfType;
65
66     @Column(name = "NF_ROLE")
67     private String nfRole;
68
69     @Column(name = "NF_NAMING_CODE")
70     private String nfNamingCode;
71
72     @Column(name = "MULTI_STAGE_DESIGN")
73     private String multiStageDesign;
74
75     @Column(name = "RESOURCE_INPUT")
76     private String resourceInput;
77
78     @ManyToOne(cascade = CascadeType.ALL)
79     @JoinColumn(name = "PNF_RESOURCE_MODEL_UUID")
80     private PnfResource pnfResources;
81
82     @Column(name = "CDS_BLUEPRINT_NAME")
83     private String blueprintName;
84
85     @Column(name = "CDS_BLUEPRINT_VERSION")
86     private String blueprintVersion;
87
88     @Override
89     public String toString() {
90         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
91             .append("modelInstanceName", modelInstanceName).append("created", created)
92             .append("nfFunction", nfFunction)
93             .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
94             .append("multiStageDesign", multiStageDesign).append("pnfResources", pnfResources)
95             .append("blueprintName", blueprintName).append("blueprintVersion", blueprintVersion)
96             .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 }