| 21720 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.dtr;
|
| 21545 |
ashik.ali |
2 |
|
|
|
3 |
import java.time.LocalDateTime;
|
|
|
4 |
|
|
|
5 |
import javax.persistence.Column;
|
|
|
6 |
import javax.persistence.Convert;
|
|
|
7 |
import javax.persistence.Entity;
|
|
|
8 |
import javax.persistence.EnumType;
|
|
|
9 |
import javax.persistence.Enumerated;
|
|
|
10 |
import javax.persistence.GeneratedValue;
|
|
|
11 |
import javax.persistence.GenerationType;
|
|
|
12 |
import javax.persistence.Id;
|
|
|
13 |
import javax.persistence.Table;
|
|
|
14 |
|
|
|
15 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
| 21720 |
ashik.ali |
16 |
import com.spice.profitmandi.dao.enumuration.dtr.ContentType;
|
| 21545 |
ashik.ali |
17 |
|
|
|
18 |
|
|
|
19 |
@Entity
|
| 21596 |
ashik.ali |
20 |
@Table(name="dtr.document", schema = "dtr")
|
| 21545 |
ashik.ali |
21 |
public class Document{
|
|
|
22 |
|
|
|
23 |
@Id
|
|
|
24 |
@Column(name="id", unique=true, updatable=false)
|
|
|
25 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
26 |
private int id;
|
|
|
27 |
|
|
|
28 |
@Column(name="name", unique = true)
|
|
|
29 |
private String name;
|
|
|
30 |
|
|
|
31 |
@Column(name = "path")
|
|
|
32 |
private String path;
|
|
|
33 |
|
|
|
34 |
@Column(name = "content_type")
|
|
|
35 |
@Enumerated(EnumType.STRING)
|
|
|
36 |
private ContentType contentType;
|
|
|
37 |
|
|
|
38 |
private long size;
|
|
|
39 |
|
|
|
40 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
41 |
private LocalDateTime createTimestamp;
|
|
|
42 |
|
|
|
43 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
44 |
private LocalDateTime updateTimestamp;
|
|
|
45 |
|
|
|
46 |
@Column(columnDefinition="tinyint(1) default 0")
|
|
|
47 |
private boolean persisted;
|
|
|
48 |
|
|
|
49 |
public int getId() {
|
|
|
50 |
return id;
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
public void setId(int id) {
|
|
|
54 |
this.id = id;
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
public String getName() {
|
|
|
58 |
return name;
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
public void setName(String name) {
|
|
|
62 |
this.name = name;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public String getPath() {
|
|
|
66 |
return path;
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
public void setPath(String path) {
|
|
|
70 |
this.path = path;
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
public ContentType getContentType() {
|
|
|
74 |
return contentType;
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
public void setContentType(ContentType contentType) {
|
|
|
78 |
this.contentType = contentType;
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
public long getSize() {
|
|
|
82 |
return size;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
public void setSize(long size) {
|
|
|
86 |
this.size = size;
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
public LocalDateTime getCreateTimestamp() {
|
|
|
90 |
return createTimestamp;
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
94 |
this.createTimestamp = createTimestamp;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
public LocalDateTime getUpdateTimestamp() {
|
|
|
98 |
return updateTimestamp;
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
|
|
|
102 |
this.updateTimestamp = updateTimestamp;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
public boolean isPersisted() {
|
|
|
107 |
return persisted;
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
public void setPersisted(boolean persisted) {
|
|
|
111 |
this.persisted = persisted;
|
|
|
112 |
}
|
|
|
113 |
|
| 21924 |
ashik.ali |
114 |
|
| 21602 |
ashik.ali |
115 |
@Override
|
| 21924 |
ashik.ali |
116 |
public int hashCode() {
|
|
|
117 |
final int prime = 31;
|
|
|
118 |
int result = 1;
|
|
|
119 |
result = prime * result + ((contentType == null) ? 0 : contentType.hashCode());
|
|
|
120 |
result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
|
|
|
121 |
result = prime * result + id;
|
|
|
122 |
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
|
|
123 |
result = prime * result + ((path == null) ? 0 : path.hashCode());
|
|
|
124 |
result = prime * result + (persisted ? 1231 : 1237);
|
|
|
125 |
result = prime * result + (int) (size ^ (size >>> 32));
|
|
|
126 |
result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
|
|
|
127 |
return result;
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
@Override
|
|
|
131 |
public boolean equals(Object obj) {
|
|
|
132 |
if (this == obj)
|
|
|
133 |
return true;
|
|
|
134 |
if (obj == null)
|
|
|
135 |
return false;
|
|
|
136 |
if (getClass() != obj.getClass())
|
|
|
137 |
return false;
|
|
|
138 |
Document other = (Document) obj;
|
|
|
139 |
if (contentType != other.contentType)
|
|
|
140 |
return false;
|
|
|
141 |
if (createTimestamp == null) {
|
|
|
142 |
if (other.createTimestamp != null)
|
|
|
143 |
return false;
|
|
|
144 |
} else if (!createTimestamp.equals(other.createTimestamp))
|
|
|
145 |
return false;
|
|
|
146 |
if (id != other.id)
|
|
|
147 |
return false;
|
|
|
148 |
if (name == null) {
|
|
|
149 |
if (other.name != null)
|
|
|
150 |
return false;
|
|
|
151 |
} else if (!name.equals(other.name))
|
|
|
152 |
return false;
|
|
|
153 |
if (path == null) {
|
|
|
154 |
if (other.path != null)
|
|
|
155 |
return false;
|
|
|
156 |
} else if (!path.equals(other.path))
|
|
|
157 |
return false;
|
|
|
158 |
if (persisted != other.persisted)
|
|
|
159 |
return false;
|
|
|
160 |
if (size != other.size)
|
|
|
161 |
return false;
|
|
|
162 |
if (updateTimestamp == null) {
|
|
|
163 |
if (other.updateTimestamp != null)
|
|
|
164 |
return false;
|
|
|
165 |
} else if (!updateTimestamp.equals(other.updateTimestamp))
|
|
|
166 |
return false;
|
|
|
167 |
return true;
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
@Override
|
| 21602 |
ashik.ali |
171 |
public String toString() {
|
|
|
172 |
return "Document [id=" + id + ", name=" + name + ", path=" + path + ", contentType=" + contentType + ", size="
|
|
|
173 |
+ size + ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp
|
|
|
174 |
+ ", persisted=" + persisted + "]";
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
|
|
|
178 |
|
| 21545 |
ashik.ali |
179 |
}
|