Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / HeatEnvironment.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.db.catalog.beans;
22
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
38 @Entity
39 @Table(name = "heat_environment")
40 public class HeatEnvironment implements Serializable {
41
42     private static final long serialVersionUID = 768026109321305392L;
43
44     @BusinessKey
45     @Id
46     @Column(name = "ARTIFACT_UUID")
47     private String artifactUuid;
48
49     @Column(name = "NAME")
50     private String name = null;
51
52     @Column(name = "DESCRIPTION")
53     private String description = null;
54
55     @Lob
56     @Column(name = "BODY", columnDefinition = "LONGTEXT")
57     private String environment = null;
58
59     @Column(name = "ARTIFACT_CHECKSUM")
60     private String artifactChecksum;
61
62     @Column(name = "CREATION_TIMESTAMP", updatable = false)
63     @Temporal(TemporalType.TIMESTAMP)
64     private Date created;
65
66     @BusinessKey
67     @Column(name = "VERSION")
68     private String version;
69
70     @PrePersist
71     protected void onCreate() {
72         this.created = new Date();
73     }
74
75     @Override
76     public boolean equals(final Object other) {
77         if (!(other instanceof HeatEnvironment)) {
78             return false;
79         }
80         HeatEnvironment castOther = (HeatEnvironment) other;
81         return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).append(version, castOther.version)
82                 .isEquals();
83     }
84
85     @Override
86     public int hashCode() {
87         return new HashCodeBuilder().append(artifactUuid).append(version).toHashCode();
88     }
89
90     public String getVersion() {
91         return version;
92     }
93
94     public void setVersion(String version) {
95         this.version = version;
96     }
97
98     public String getArtifactUuid() {
99         return this.artifactUuid;
100     }
101
102     public void setArtifactUuid(String artifactUuid) {
103         this.artifactUuid = artifactUuid;
104     }
105
106     public String getName() {
107         return name;
108     }
109
110     public void setName(String name) {
111         this.name = name;
112     }
113
114     public String getDescription() {
115         return this.description;
116     }
117
118     public void setDescription(String description) {
119         this.description = description;
120     }
121
122     public String getEnvironment() {
123         return this.environment;
124     }
125
126     public void setEnvironment(String environment) {
127         this.environment = environment;
128     }
129
130     public String getArtifactChecksum() {
131         return artifactChecksum;
132     }
133
134     public void setArtifactChecksum(String artifactChecksum) {
135         this.artifactChecksum = artifactChecksum;
136     }
137
138     public Date getCreated() {
139         return created;
140     }
141
142     @Override
143     public String toString() {
144         StringBuilder sb = new StringBuilder();
145         sb.append("Artifact UUID=" + this.artifactUuid);
146         sb.append(", name=");
147         sb.append(name);
148         sb.append(", version=");
149         sb.append(version);
150         sb.append(", description=");
151         sb.append(this.description == null ? "null" : this.description);
152         sb.append(", body=");
153         sb.append(this.environment == null ? "null" : this.environment);
154         if (this.created != null) {
155             sb.append(",creationTimestamp=");
156             sb.append(DateFormat.getInstance().format(this.created));
157         }
158         return sb.toString();
159     }
160 }