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;
35 import uk.co.blackpepper.bowman.annotation.RemoteResource;
38 @RemoteResource("/pnfResource")
39 @Table(name = "pnf_resource")
40 public class PnfResource implements Serializable {
42 private static final long serialVersionUID = 7680261093213053483L;
46 @Column(name = "MODEL_UUID")
47 private String modelUUID;
49 @Column(name = "MODEL_INVARIANT_UUID")
50 private String modelInvariantUUID;
52 @Column(name = "MODEL_NAME")
53 private String modelName;
55 @Column(name = "MODEL_VERSION")
56 private String modelVersion;
58 @Column(name = "TOSCA_NODE_TYPE")
59 private String toscaNodeType;
61 @Column(name = "DESCRIPTION")
62 private String description;
64 @Column(name = "ORCHESTRATION_MODE")
65 private String orchestrationMode;
67 @Column(name = "RESOURCE_CATEGORY")
68 private String category;
70 @Column(name = "RESOURCE_SUB_CATEGORY")
71 private String subCategory;
73 @Column(name = "CREATION_TIMESTAMP", updatable = false)
74 @Temporal(TemporalType.TIMESTAMP)
77 @OneToMany(fetch = FetchType.LAZY, mappedBy = "pnfResources")
78 private List<PnfResourceCustomization> pnfResourceCustomizations;
81 protected void onCreate() {
82 this.created = new Date();
86 public String toString() {
87 return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
88 .append("modelName", modelName).append("modelVersion", modelVersion)
89 .append("toscaNodeType", toscaNodeType).append("description", description)
90 .append("orchestrationMode", orchestrationMode).append("created", created)
91 .append("pnfResourceCustomizations", pnfResourceCustomizations).toString();
95 public boolean equals(final Object other) {
96 if (!(other instanceof PnfResource)) {
99 PnfResource castOther = (PnfResource) other;
100 return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
104 public int hashCode() {
105 return new HashCodeBuilder().append(modelUUID).toHashCode();
108 public String getOrchestrationMode() {
109 return orchestrationMode;
112 public void setOrchestrationMode(String orchestrationMode) {
113 this.orchestrationMode = orchestrationMode;
116 public String getDescription() {
120 public void setDescription(String description) {
121 this.description = description;
124 public Date getCreated() {
129 * @return Returns the category.
131 public String getCategory() {
136 * @param category The category to set.
138 public void setCategory(String category) {
139 this.category = category;
143 * @return Returns the subCategory.
145 public String getSubCategory() {
150 * @param subCategory The subCategory to set.
152 public void setSubCategory(String subCategory) {
153 this.subCategory = subCategory;
156 public String getModelInvariantUUID() {
157 return this.modelInvariantUUID;
160 public void setModelInvariantUUID(String modelInvariantUUID) {
161 this.modelInvariantUUID = modelInvariantUUID;
164 public String getModelName() {
168 public void setModelName(String modelName) {
169 this.modelName = modelName;
172 public String getModelUUID() {
176 public void setModelUUID(String modelUUID) {
177 this.modelUUID = modelUUID;
180 public String getModelInvariantId() {
181 return this.modelInvariantUUID;
184 public String getToscaNodeType() {
185 return toscaNodeType;
188 public void setToscaNodeType(String toscaNodeType) {
189 this.toscaNodeType = toscaNodeType;
193 public List<PnfResourceCustomization> getPnfResourceCustomizations() {
194 if (pnfResourceCustomizations == null) {
195 pnfResourceCustomizations = new ArrayList<>();
197 return pnfResourceCustomizations;
200 public void setPnfResourceCustomizations(List<PnfResourceCustomization> pnfResourceCustomizations) {
201 this.pnfResourceCustomizations = pnfResourceCustomizations;
204 public String getModelVersion() {
208 public void setModelVersion(String modelVersion) {
209 this.modelVersion = modelVersion;