6fe1e08f0d33a0a8674b8b5f971a63d6e33d4897
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / HeatFiles.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.util.Date;
25
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
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
39 import com.openpojo.business.annotation.BusinessKey;
40
41 @Entity
42 @Table(name = "heat_files")
43 public class HeatFiles implements Serializable {
44
45         private static final long serialVersionUID = 768026109321305392L;
46
47         @BusinessKey
48         @Id
49         @Column(name = "ARTIFACT_UUID")
50         private String artifactUuid;
51
52         @Column(name = "DESCRIPTION")
53         private String description = null;
54
55         @Column(name = "NAME")
56         private String fileName;
57
58         @Lob
59         @Column(name = "BODY", columnDefinition = "LONGTEXT")
60         private String fileBody;
61
62         @Column(name = "CREATION_TIMESTAMP", updatable = false)
63         @Temporal(TemporalType.TIMESTAMP)
64         private Date created;
65
66         @Column(name = "ARTIFACT_CHECKSUM")
67         private String artifactChecksum;
68
69         @Column(name = "VERSION")
70         private String version;
71
72         @PrePersist
73         protected void onCreate() {
74                 this.created = new Date();
75         }
76
77         @Override
78         public String toString() {
79                 return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("description", description)
80                                 .append("fileName", fileName).append("fileBody", fileBody).append("created", created)
81                                 .append("artifactChecksum", artifactChecksum).toString();
82         }
83
84         @Override
85         public boolean equals(final Object other) {
86                 if (!(other instanceof HeatFiles)) {
87                         return false;
88                 }
89                 HeatFiles castOther = (HeatFiles) other;
90                 return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).isEquals();
91         }
92
93         @Override
94         public int hashCode() {
95                 return new HashCodeBuilder().append(artifactUuid).toHashCode();
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 getDescription() {
107                 return this.description;
108         }
109
110         public void setDescription(String description) {
111                 this.description = description;
112         }
113
114         public String getFileName() {
115                 return this.fileName;
116         }
117
118         public void setFileName(String fileName) {
119                 this.fileName = fileName;
120         }
121
122         public String getFileBody() {
123                 return this.fileBody;
124         }
125
126         public void setFileBody(String fileBody) {
127                 this.fileBody = fileBody;
128         }
129
130         public Date getCreated() {
131                 return created;
132         }
133
134         public String getAsdcUuid() {
135                 return this.artifactUuid;
136         }
137
138         public void setAsdcUuid(String artifactUuid) {
139                 this.artifactUuid = artifactUuid;
140         }
141
142         public String getArtifactChecksum() {
143                 return artifactChecksum;
144         }
145
146         public void setArtifactChecksum(String artifactChecksum) {
147                 this.artifactChecksum = artifactChecksum;
148         }
149
150         public String getVersion() {
151                 return version;
152         }
153
154         public void setVersion(String version) {
155                 this.version = version;
156         }
157 }