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
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
12 * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
15 package org.onap.so.db.catalog.beans;
17 import com.openpojo.business.annotation.BusinessKey;
18 import java.io.Serializable;
19 import java.util.ArrayList;
20 import java.util.Date;
21 import java.util.List;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.FetchType;
25 import javax.persistence.Id;
26 import javax.persistence.OneToMany;
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;
37 @Table(name = "pnf_resource")
38 public class PnfResource implements Serializable {
40 private static final long serialVersionUID = 7680261093213053483L;
44 @Column(name = "MODEL_UUID")
45 private String modelUUID;
47 @Column(name = "MODEL_INVARIANT_UUID")
48 private String modelInvariantUUID;
50 @Column(name = "MODEL_NAME")
51 private String modelName;
53 @Column(name = "MODEL_VERSION")
54 private String modelVersion;
56 @Column(name = "TOSCA_NODE_TYPE")
57 private String toscaNodeType;
59 @Column(name = "DESCRIPTION")
60 private String description;
62 @Column(name = "ORCHESTRATION_MODE")
63 private String orchestrationMode;
65 @Column(name = "RESOURCE_CATEGORY")
66 private String category;
68 @Column(name = "RESOURCE_SUB_CATEGORY")
69 private String subCategory;
71 @Column(name = "CREATION_TIMESTAMP", updatable = false)
72 @Temporal(TemporalType.TIMESTAMP)
75 @OneToMany(fetch = FetchType.LAZY, mappedBy = "pnfResources")
76 private List<PnfResourceCustomization> pnfResourceCustomizations;
79 protected void onCreate() {
80 this.created = new Date();
84 public String toString() {
85 return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
86 .append("modelName", modelName).append("modelVersion", modelVersion)
87 .append("toscaNodeType", toscaNodeType).append("description", description)
88 .append("orchestrationMode", orchestrationMode).append("created", created)
89 .append("pnfResourceCustomizations", pnfResourceCustomizations).toString();
93 public boolean equals(final Object other) {
94 if (!(other instanceof PnfResource)) {
97 PnfResource castOther = (PnfResource) other;
98 return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
102 public int hashCode() {
103 return new HashCodeBuilder().append(modelUUID).toHashCode();
106 public String getOrchestrationMode() {
107 return orchestrationMode;
110 public void setOrchestrationMode(String orchestrationMode) {
111 this.orchestrationMode = orchestrationMode;
114 public String getDescription() {
118 public void setDescription(String description) {
119 this.description = description;
122 public Date getCreated() {
127 * @return Returns the category.
129 public String getCategory() {
134 * @param category The category to set.
136 public void setCategory(String category) {
137 this.category = category;
141 * @return Returns the subCategory.
143 public String getSubCategory() {
148 * @param subCategory The subCategory to set.
150 public void setSubCategory(String subCategory) {
151 this.subCategory = subCategory;
154 public String getModelInvariantUUID() {
155 return this.modelInvariantUUID;
158 public void setModelInvariantUUID(String modelInvariantUUID) {
159 this.modelInvariantUUID = modelInvariantUUID;
162 public String getModelName() {
166 public void setModelName(String modelName) {
167 this.modelName = modelName;
170 public String getModelUUID() {
174 public void setModelUUID(String modelUUID) {
175 this.modelUUID = modelUUID;
178 public String getModelInvariantId() {
179 return this.modelInvariantUUID;
182 public String getToscaNodeType() {
183 return toscaNodeType;
186 public void setToscaNodeType(String toscaNodeType) {
187 this.toscaNodeType = toscaNodeType;
191 public List<PnfResourceCustomization> getPnfResourceCustomizations() {
192 if (pnfResourceCustomizations == null) {
193 pnfResourceCustomizations = new ArrayList<>();
195 return pnfResourceCustomizations;
198 public void setPnfResourceCustomizations(List<PnfResourceCustomization> pnfResourceCustomizations) {
199 this.pnfResourceCustomizations = pnfResourceCustomizations;
202 public String getModelVersion() {
206 public void setModelVersion(String modelVersion) {
207 this.modelVersion = modelVersion;