[SDC-29] rebase continue work to align source
[sdc.git] / catalog-dao / src / main / java / org / openecomp / sdc / be / resources / data / SdcSchemaFilesData.java
1 package org.openecomp.sdc.be.resources.data;
2
3 import java.nio.ByteBuffer;
4 import java.util.Date;
5
6 import com.datastax.driver.mapping.annotations.ClusteringColumn;
7 import com.datastax.driver.mapping.annotations.Column;
8 import com.datastax.driver.mapping.annotations.PartitionKey;
9 import com.datastax.driver.mapping.annotations.Table;
10
11 @Table(keyspace = "sdcartifact", name = "sdcschemafiles")
12 public class SdcSchemaFilesData {
13         @PartitionKey(0)
14         @Column(name = "sdcreleasenum")
15         private String sdcReleaseNum;
16         
17         @ClusteringColumn
18         @Column(name = "timestamp")
19         private Date timestamp;
20         
21         @PartitionKey(1)
22         @Column(name = "conformanceLevel")
23         private String conformanceLevel;
24
25         @Column(name = "fileName")
26         private String fileName;
27
28         @Column(name = "payload")
29         private ByteBuffer payload;
30         
31         @Column(name = "checksum")
32         private String checksum;
33         
34         public SdcSchemaFilesData() {
35         
36         }
37         
38         public SdcSchemaFilesData(String sdcReleaseNum, Date timestamp, String conformanceLevel, String fileName, byte[] payload, String checksum){
39                 this.sdcReleaseNum = sdcReleaseNum;
40                 this.timestamp = timestamp;
41                 this.conformanceLevel = conformanceLevel;
42                 this.fileName = fileName;
43                 if(payload != null) {
44                         this.payload = ByteBuffer.wrap(payload.clone());
45                 }
46                 this.checksum = checksum;
47         }
48         
49         public String getSdcReleaseNum() {
50                 return sdcReleaseNum;
51         }
52
53         public void setSdcReleaseNum(String sdcReleaseNum) {
54                 this.sdcReleaseNum = sdcReleaseNum;
55         }
56
57         public String getConformanceLevel() {
58                 return conformanceLevel;
59         }
60
61         public void setConformanceLevel(String conformanceLevel) {
62                 this.conformanceLevel = conformanceLevel;
63         }
64
65         public String getFileName() {
66                 return fileName;
67         }
68
69         public void setFileName(String fileName) {
70                 this.fileName = fileName;
71         }
72
73         public ByteBuffer getPayload() {
74                 return payload;
75         }
76
77         public void setPayload(ByteBuffer payload) {
78                 if(payload != null){
79                         this.payload = payload.duplicate();
80                 }
81         }
82         
83         public void setPayloadAsArray(byte[] payload) {
84                 if(payload != null){
85                         this.payload = ByteBuffer.wrap(payload.clone());
86                 }
87         }
88         
89         public byte[] getPayloadAsArray() {
90                 return payload != null ? payload.array() : null;
91         }
92
93         public Date getTimestamp() {
94                 return timestamp;
95         }
96
97         public void setTimestamp(Date timestamp) {
98                 this.timestamp = timestamp;
99         }
100
101         public String getChecksum() {
102                 return checksum;
103         }
104
105         public void setChecksum(String checksum) {
106                 this.checksum = checksum;
107         }
108
109         @Override
110         public String toString() {
111                 return "SdcSchemaFilesData [sdcReleaseNum=" + sdcReleaseNum + ", timestamp=" + timestamp + ", conformanceLevel="
112                                 + conformanceLevel + ", fileName=" + fileName + ", checksum=" + checksum + "]";
113         }
114 }