2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (c) 2019, CMCC Technologies Co., Ltd.
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 com.fasterxml.jackson.annotation.JsonFormat;
24 import com.openpojo.business.annotation.BusinessKey;
25 import org.apache.commons.lang3.builder.ToStringBuilder;
26 import javax.persistence.*;
27 import java.io.Serializable;
28 import java.util.Date;
29 import java.util.Objects;
32 @Table(name = "service_artifact")
33 public class ServiceArtifact implements Serializable {
35 private static final long serialVersionUID = 768026109321305392L;
39 @Column(name = "ARTIFACT_UUID")
40 private String artifactUUID;
42 @Column(name = "TYPE")
45 @Column(name = "NAME")
48 @Column(name = "VERSION")
49 private String version;
51 @Column(name = "DESCRIPTION")
52 private String description;
54 @Column(name = "CONTENT", columnDefinition = "LONGTEXT")
55 private String content;
57 @Column(name = "CHECKSUM")
58 private String checksum;
60 @Column(name = "CREATION_TIMESTAMP", updatable = false)
61 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
62 @Temporal(TemporalType.TIMESTAMP)
63 private Date creationTimestamp;
65 @ManyToOne(cascade = CascadeType.ALL)
66 @JoinColumn(name = "SERVICE_MODEL_UUID")
67 private Service service;
70 protected void onCreate() {
71 this.creationTimestamp = new Date();
74 public String getArtifactUUID() {
78 public void setArtifactUUID(String artifactUUID) {
79 this.artifactUUID = artifactUUID;
83 public String getType() {
87 public void setType(String type) {
91 public String getName() {
95 public void setName(String name) {
99 public String getVersion() {
103 public void setVersion(String version) {
104 this.version = version;
107 public String getDescription() {
111 public void setDescription(String description) {
112 this.description = description;
115 public String getContent() {
119 public void setContent(String content) {
120 this.content = content;
123 public String getChecksum() {
127 public void setChecksum(String checksum) {
128 this.checksum = checksum;
131 public Date getCreationTimestamp() {
132 return creationTimestamp;
135 public void setCreationTimestamp(Date creationTimestamp) {
136 this.creationTimestamp = creationTimestamp;
139 public Service getService() {
143 public void setService(Service service) {
144 this.service = service;
148 public String toString() {
149 return new ToStringBuilder(this).append("artifactUUID", artifactUUID).append("type", type).append("name", name)
150 .append("version", version).append("description", description).append("content", content)
151 .append("checksum", checksum).append("creationTimestamp", creationTimestamp).toString();
155 public boolean equals(Object o) {
158 if (o == null || getClass() != o.getClass())
160 ServiceArtifact that = (ServiceArtifact) o;
161 return artifactUUID.equals(that.artifactUUID);
165 public int hashCode() {
166 return Objects.hash(artifactUUID);