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;
25 import java.util.List;
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.PrePersist;
32 import javax.persistence.Table;
33 import javax.persistence.Temporal;
34 import javax.persistence.TemporalType;
35 import org.apache.commons.lang3.builder.EqualsBuilder;
36 import org.apache.commons.lang3.builder.HashCodeBuilder;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
38 import com.fasterxml.jackson.annotation.JsonIgnore;
39 import com.openpojo.business.annotation.BusinessKey;
40 import uk.co.blackpepper.bowman.annotation.LinkedResource;
43 @Table(name = "tosca_csar")
44 public class ToscaCsar implements Serializable {
46 private static final long serialVersionUID = 768026109321305392L;
50 @Column(name = "ARTIFACT_UUID")
51 private String artifactUUID;
53 @Column(name = "NAME")
56 @Column(name = "ARTIFACT_CHECKSUM")
57 private String artifactChecksum;
62 @Column(name = "DESCRIPTION")
63 private String description;
65 @Column(name = "CREATION_TIMESTAMP", updatable = false)
66 @Temporal(TemporalType.TIMESTAMP)
70 @Column(name = "Version")
71 private String version;
73 @OneToMany(cascade = CascadeType.ALL, mappedBy = "csar")
75 private List<Service> services;
78 public String toString() {
79 return new ToStringBuilder(this).append("artifactUUID", artifactUUID).append("name", name)
80 .append("artifactChecksum", artifactChecksum).append("url", url).append("description", description)
81 .append("created", created).append("version", version).append("services", services).toString();
85 protected void onCreate() {
86 this.created = new Date();
90 public boolean equals(final Object other) {
91 if (!(other instanceof ToscaCsar)) {
94 ToscaCsar castOther = (ToscaCsar) other;
95 return new EqualsBuilder().append(artifactUUID, castOther.artifactUUID).append(version, castOther.version)
100 public int hashCode() {
101 return new HashCodeBuilder().append(artifactUUID).append(version).toHashCode();
104 public ToscaCsar() {}
106 public String getArtifactUUID() {
110 public void setArtifactUUID(String artifactUUID) {
111 this.artifactUUID = artifactUUID;
114 public String getName() {
118 public void setName(String name) {
122 public String getVersion() {
126 public void setVersion(String version) {
127 this.version = version;
130 public String getArtifactChecksum() {
131 return artifactChecksum;
134 public void setArtifactChecksum(String artifactChecksum) {
135 this.artifactChecksum = artifactChecksum;
138 public String getUrl() {
142 public void setUrl(String url) {
146 public String getDescription() {
150 public void setDescription(String description) {
151 this.description = description;
154 public Date getCreated() {
159 public List<Service> getServices() {
163 public void setServices(List<Service> services) {
164 this.services = services;