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;
41 import uk.co.blackpepper.bowman.annotation.RemoteResource;
44 @RemoteResource("/collectionResource")
45 @Table(name = "collection_resource")
46 public class CollectionResource implements Serializable {
51 private static final long serialVersionUID = -8612818857960992110L;
55 @Column(name = "MODEL_UUID")
56 private String modelUUID;
58 @Column(name = "MODEL_NAME")
59 private String modelName;
61 @Column(name = "MODEL_INVARIANT_UUID")
62 private String modelInvariantUUID;
64 @Column(name = "MODEL_VERSION")
65 private String modelVersion;
67 @Column(name = "TOSCA_NODE_TYPE")
68 private String toscaNodeType;
70 @Column(name = "DESCRIPTION")
71 private String description;
73 @Column(name = "CREATION_TIMESTAMP", updatable = false)
74 @Temporal(TemporalType.TIMESTAMP)
77 @OneToMany(cascade = CascadeType.ALL, mappedBy = "collectionResource")
78 private Set<CollectionResourceCustomization> collectionResourceCustomization;
80 @OneToOne(cascade = CascadeType.ALL, mappedBy = "collectionResource")
81 private InstanceGroup instanceGroup;
84 public boolean equals(final Object other) {
85 if (!(other instanceof CollectionResource)) {
88 CollectionResource castOther = (CollectionResource) other;
89 return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
93 public int hashCode() {
94 return new HashCodeBuilder().append(modelUUID).toHashCode();
97 public Set<CollectionResourceCustomization> getCollectionResourceCustomization() {
98 return collectionResourceCustomization;
101 public void setCollectionResourceCustomization(
102 Set<CollectionResourceCustomization> collectionResourceCustomization) {
103 this.collectionResourceCustomization = collectionResourceCustomization;
106 public String getModelUUID() {
110 public Date getCreated() {
115 protected void onCreate() {
116 this.created = new Date();
119 public void setModelUUID(String modelUUID) {
120 this.modelUUID = modelUUID;
123 public String getModelName() {
127 public void setModelName(String modelName) {
128 this.modelName = modelName;
131 public String getModelInvariantUUID() {
132 return modelInvariantUUID;
135 public void setModelInvariantUUID(String modelInvariantUUID) {
136 this.modelInvariantUUID = modelInvariantUUID;
139 public String getModelVersion() {
143 public void setModelVersion(String modelVersion) {
144 this.modelVersion = modelVersion;
147 public String getToscaNodeType() {
148 return toscaNodeType;
151 public void setToscaNodeType(String toscaNodeType) {
152 this.toscaNodeType = toscaNodeType;
155 public String getDescription() {
159 public void setDescription(String description) {
160 this.description = description;
164 public InstanceGroup getInstanceGroup() {
165 return instanceGroup;
168 public void setInstanceGroup(InstanceGroup instanceGroup) {
169 this.instanceGroup = instanceGroup;
173 public String toString() {
174 return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelName", modelName)
175 .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion)
176 .append("toscaNodeType", toscaNodeType).append("description", description).append("created", created)