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;
27 import javax.persistence.CascadeType;
28 import javax.persistence.Column;
29 import javax.persistence.Entity;
30 import javax.persistence.Id;
31 import javax.persistence.OneToMany;
32 import javax.persistence.PrePersist;
33 import javax.persistence.Table;
34 import javax.persistence.Temporal;
35 import javax.persistence.TemporalType;
37 import org.apache.commons.lang3.builder.EqualsBuilder;
38 import org.apache.commons.lang3.builder.HashCodeBuilder;
39 import org.apache.commons.lang3.builder.ToStringBuilder;
41 import com.fasterxml.jackson.annotation.JsonIgnore;
42 import com.openpojo.business.annotation.BusinessKey;
44 import uk.co.blackpepper.bowman.annotation.LinkedResource;
47 @Table(name = "tosca_csar")
48 public class ToscaCsar implements Serializable {
50 private static final long serialVersionUID = 768026109321305392L;
54 @Column(name = "ARTIFACT_UUID")
55 private String artifactUUID;
57 @Column(name = "NAME")
60 @Column(name = "ARTIFACT_CHECKSUM")
61 private String artifactChecksum;
66 @Column(name = "DESCRIPTION")
67 private String description;
69 @Column(name = "CREATION_TIMESTAMP", updatable = false)
70 @Temporal(TemporalType.TIMESTAMP)
74 @Column(name = "Version")
75 private String version;
77 @OneToMany(cascade = CascadeType.ALL, mappedBy = "csar")
79 private List<Service> services;
82 public String toString() {
83 return new ToStringBuilder(this).append("artifactUUID", artifactUUID).append("name", name)
84 .append("artifactChecksum", artifactChecksum).append("url", url).append("description", description)
85 .append("created", created).append("version", version).append("services", services).toString();
89 protected void onCreate() {
90 this.created = new Date();
94 public boolean equals(final Object other) {
95 if (!(other instanceof ToscaCsar)) {
98 ToscaCsar castOther = (ToscaCsar) other;
99 return new EqualsBuilder().append(artifactUUID, castOther.artifactUUID).append(version, castOther.version)
104 public int hashCode() {
105 return new HashCodeBuilder().append(artifactUUID).append(version).toHashCode();
111 public String getArtifactUUID() {
115 public void setArtifactUUID(String artifactUUID) {
116 this.artifactUUID = artifactUUID;
119 public String getName() {
123 public void setName(String name) {
127 public String getVersion() {
131 public void setVersion(String version) {
132 this.version = version;
135 public String getArtifactChecksum() {
136 return artifactChecksum;
139 public void setArtifactChecksum(String artifactChecksum) {
140 this.artifactChecksum = artifactChecksum;
143 public String getUrl() {
147 public void setUrl(String url) {
151 public String getDescription() {
155 public void setDescription(String description) {
156 this.description = description;
159 public Date getCreated() {
164 public List<Service> getServices() {
168 public void setServices(List<Service> services) {
169 this.services = services;