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;
41 import uk.co.blackpepper.bowman.annotation.RemoteResource;
44 @RemoteResource("/toscaCsar")
45 @Table(name = "tosca_csar")
46 public class ToscaCsar implements Serializable {
48 private static final long serialVersionUID = 768026109321305392L;
52 @Column(name = "ARTIFACT_UUID")
53 private String artifactUUID;
55 @Column(name = "NAME")
58 @Column(name = "ARTIFACT_CHECKSUM")
59 private String artifactChecksum;
64 @Column(name = "DESCRIPTION")
65 private String description;
67 @Column(name = "CREATION_TIMESTAMP", updatable = false)
68 @Temporal(TemporalType.TIMESTAMP)
72 @Column(name = "Version")
73 private String version;
75 @OneToMany(cascade = CascadeType.ALL, mappedBy = "csar")
77 private List<Service> services;
80 public String toString() {
81 return new ToStringBuilder(this).append("artifactUUID", artifactUUID).append("name", name)
82 .append("artifactChecksum", artifactChecksum).append("url", url).append("description", description)
83 .append("created", created).append("version", version).append("services", services).toString();
87 protected void onCreate() {
88 this.created = new Date();
92 public boolean equals(final Object other) {
93 if (!(other instanceof ToscaCsar)) {
96 ToscaCsar castOther = (ToscaCsar) other;
97 return new EqualsBuilder().append(artifactUUID, castOther.artifactUUID).append(version, castOther.version)
102 public int hashCode() {
103 return new HashCodeBuilder().append(artifactUUID).append(version).toHashCode();
106 public ToscaCsar() {}
108 public String getArtifactUUID() {
112 public void setArtifactUUID(String artifactUUID) {
113 this.artifactUUID = artifactUUID;
116 public String getName() {
120 public void setName(String name) {
124 public String getVersion() {
128 public void setVersion(String version) {
129 this.version = version;
132 public String getArtifactChecksum() {
133 return artifactChecksum;
136 public void setArtifactChecksum(String artifactChecksum) {
137 this.artifactChecksum = artifactChecksum;
140 public String getUrl() {
144 public void setUrl(String url) {
148 public String getDescription() {
152 public void setDescription(String description) {
153 this.description = description;
156 public Date getCreated() {
161 public List<Service> getServices() {
165 public void setServices(List<Service> services) {
166 this.services = services;