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;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.Id;
29 import javax.persistence.Lob;
30 import javax.persistence.PrePersist;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34 import org.apache.commons.lang3.builder.EqualsBuilder;
35 import org.apache.commons.lang3.builder.HashCodeBuilder;
36 import com.openpojo.business.annotation.BusinessKey;
37 import uk.co.blackpepper.bowman.annotation.RemoteResource;
40 @RemoteResource("/heatEnvironment")
41 @Table(name = "heat_environment")
42 public class HeatEnvironment implements Serializable {
44 private static final long serialVersionUID = 768026109321305392L;
48 @Column(name = "ARTIFACT_UUID")
49 private String artifactUuid;
51 @Column(name = "NAME")
52 private String name = null;
54 @Column(name = "DESCRIPTION")
55 private String description = null;
58 @Column(name = "BODY", columnDefinition = "LONGTEXT")
59 private String environment = null;
61 @Column(name = "ARTIFACT_CHECKSUM")
62 private String artifactChecksum;
64 @Column(name = "CREATION_TIMESTAMP", updatable = false)
65 @Temporal(TemporalType.TIMESTAMP)
69 @Column(name = "VERSION")
70 private String version;
73 protected void onCreate() {
74 this.created = new Date();
78 public boolean equals(final Object other) {
79 if (!(other instanceof HeatEnvironment)) {
82 HeatEnvironment castOther = (HeatEnvironment) other;
83 return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).append(version, castOther.version)
88 public int hashCode() {
89 return new HashCodeBuilder().append(artifactUuid).append(version).toHashCode();
92 public String getVersion() {
96 public void setVersion(String version) {
97 this.version = version;
100 public String getArtifactUuid() {
101 return this.artifactUuid;
104 public void setArtifactUuid(String artifactUuid) {
105 this.artifactUuid = artifactUuid;
108 public String getName() {
112 public void setName(String name) {
116 public String getDescription() {
117 return this.description;
120 public void setDescription(String description) {
121 this.description = description;
124 public String getEnvironment() {
125 return this.environment;
128 public void setEnvironment(String environment) {
129 this.environment = environment;
132 public String getArtifactChecksum() {
133 return artifactChecksum;
136 public void setArtifactChecksum(String artifactChecksum) {
137 this.artifactChecksum = artifactChecksum;
140 public Date getCreated() {
145 public String toString() {
146 StringBuilder sb = new StringBuilder();
147 sb.append("Artifact UUID=" + this.artifactUuid);
148 sb.append(", name=");
150 sb.append(", version=");
152 sb.append(", description=");
153 sb.append(this.description == null ? "null" : this.description);
154 sb.append(", body=");
155 sb.append(this.environment == null ? "null" : this.environment);
156 if (this.created != null) {
157 sb.append(",creationTimestamp=");
158 sb.append(DateFormat.getInstance().format(this.created));
160 return sb.toString();