2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.db.catalog.beans;
23 import java.io.Serializable;
24 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.OneToMany;
31 import javax.persistence.OneToOne;
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 com.openpojo.business.annotation.BusinessKey;
40 import uk.co.blackpepper.bowman.annotation.LinkedResource;
43 @Table(name = "collection_resource")
44 public class CollectionResource implements Serializable {
49 private static final long serialVersionUID = -8612818857960992110L;
53 @Column(name = "MODEL_UUID")
54 private String modelUUID;
56 @Column(name = "MODEL_NAME")
57 private String modelName;
59 @Column(name = "MODEL_INVARIANT_UUID")
60 private String modelInvariantUUID;
62 @Column(name = "MODEL_VERSION")
63 private String modelVersion;
65 @Column(name = "TOSCA_NODE_TYPE")
66 private String toscaNodeType;
68 @Column(name = "DESCRIPTION")
69 private String description;
71 @Column(name = "CREATION_TIMESTAMP", updatable = false)
72 @Temporal(TemporalType.TIMESTAMP)
75 @OneToMany(cascade = CascadeType.ALL, mappedBy = "collectionResource")
76 private Set<CollectionResourceCustomization> collectionResourceCustomization;
78 @OneToOne(cascade = CascadeType.ALL, mappedBy = "collectionResource")
79 private InstanceGroup instanceGroup;
82 public boolean equals(final Object other) {
83 if (!(other instanceof CollectionResource)) {
86 CollectionResource castOther = (CollectionResource) other;
87 return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
91 public int hashCode() {
92 return new HashCodeBuilder().append(modelUUID).toHashCode();
95 public Set<CollectionResourceCustomization> getCollectionResourceCustomization() {
96 return collectionResourceCustomization;
99 public void setCollectionResourceCustomization(
100 Set<CollectionResourceCustomization> collectionResourceCustomization) {
101 this.collectionResourceCustomization = collectionResourceCustomization;
104 public String getModelUUID() {
108 public Date getCreated() {
113 protected void onCreate() {
114 this.created = new Date();
117 public void setModelUUID(String modelUUID) {
118 this.modelUUID = modelUUID;
121 public String getModelName() {
125 public void setModelName(String modelName) {
126 this.modelName = modelName;
129 public String getModelInvariantUUID() {
130 return modelInvariantUUID;
133 public void setModelInvariantUUID(String modelInvariantUUID) {
134 this.modelInvariantUUID = modelInvariantUUID;
137 public String getModelVersion() {
141 public void setModelVersion(String modelVersion) {
142 this.modelVersion = modelVersion;
145 public String getToscaNodeType() {
146 return toscaNodeType;
149 public void setToscaNodeType(String toscaNodeType) {
150 this.toscaNodeType = toscaNodeType;
153 public String getDescription() {
157 public void setDescription(String description) {
158 this.description = description;
162 public InstanceGroup getInstanceGroup() {
163 return instanceGroup;
166 public void setInstanceGroup(InstanceGroup instanceGroup) {
167 this.instanceGroup = instanceGroup;
171 public String toString() {
172 return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelName", modelName)
173 .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion)
174 .append("toscaNodeType", toscaNodeType).append("description", description).append("created", created)