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.text.DateFormat;
25 import java.util.Date;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.Id;
30 import javax.persistence.Lob;
31 import javax.persistence.PrePersist;
32 import javax.persistence.Table;
33 import javax.persistence.Temporal;
34 import javax.persistence.TemporalType;
36 import org.apache.commons.lang3.builder.EqualsBuilder;
37 import org.apache.commons.lang3.builder.HashCodeBuilder;
39 import com.openpojo.business.annotation.BusinessKey;
42 @Table(name = "heat_environment")
43 public class HeatEnvironment implements Serializable {
45 private static final long serialVersionUID = 768026109321305392L;
49 @Column(name = "ARTIFACT_UUID")
50 private String artifactUuid;
52 @Column(name = "NAME")
53 private String name = null;
55 @Column(name = "DESCRIPTION")
56 private String description = null;
59 @Column(name = "BODY", columnDefinition = "LONGTEXT")
60 private String environment = null;
62 @Column(name = "ARTIFACT_CHECKSUM")
63 private String artifactChecksum;
65 @Column(name = "CREATION_TIMESTAMP", updatable = false)
66 @Temporal(TemporalType.TIMESTAMP)
70 @Column(name = "VERSION")
71 private String version;
74 protected void onCreate() {
75 this.created = new Date();
79 public boolean equals(final Object other) {
80 if (!(other instanceof HeatEnvironment)) {
83 HeatEnvironment castOther = (HeatEnvironment) other;
84 return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).append(version, castOther.version)
89 public int hashCode() {
90 return new HashCodeBuilder().append(artifactUuid).append(version).toHashCode();
93 public String getVersion() {
97 public void setVersion(String version) {
98 this.version = version;
101 public String getArtifactUuid() {
102 return this.artifactUuid;
105 public void setArtifactUuid(String artifactUuid) {
106 this.artifactUuid = artifactUuid;
109 public String getName() {
113 public void setName(String name) {
117 public String getDescription() {
118 return this.description;
121 public void setDescription(String description) {
122 this.description = description;
125 public String getEnvironment() {
126 return this.environment;
129 public void setEnvironment(String environment) {
130 this.environment = environment;
133 public String getArtifactChecksum() {
134 return artifactChecksum;
137 public void setArtifactChecksum(String artifactChecksum) {
138 this.artifactChecksum = artifactChecksum;
141 public Date getCreated() {
146 public String toString() {
147 StringBuilder sb = new StringBuilder();
148 sb.append("Artifact UUID=" + this.artifactUuid);
149 sb.append(", name=");
151 sb.append(", version=");
153 sb.append(", description=");
154 sb.append(this.description == null ? "null" : this.description);
155 sb.append(", body=");
156 sb.append(this.environment == null ? "null" : this.environment);
157 if (this.created != null) {
158 sb.append(",creationTimestamp=");
159 sb.append(DateFormat.getInstance().format(this.created));
161 return sb.toString();