1
2
3
4
5
6 package fr.ifremer.quadrige2.core.dao.referential.taxon;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 import fr.ifremer.quadrige2.core.dao.referential.Status;
30 import java.io.Serializable;
31 import java.sql.Timestamp;
32 import java.util.Collection;
33 import java.util.Date;
34 import java.util.HashSet;
35
36
37
38
39
40 public abstract class ReferenceDocument
41 implements Serializable, Comparable<ReferenceDocument>
42 {
43
44
45
46 private static final long serialVersionUID = 5245706815407059828L;
47
48
49 private Integer refDocId;
50
51
52
53
54
55 public Integer getRefDocId()
56 {
57 return this.refDocId;
58 }
59
60
61
62
63
64 public void setRefDocId(Integer refDocIdIn)
65 {
66 this.refDocId = refDocIdIn;
67 }
68
69 private String refDocRefer;
70
71
72
73
74
75 public String getRefDocRefer()
76 {
77 return this.refDocRefer;
78 }
79
80
81
82
83
84 public void setRefDocRefer(String refDocReferIn)
85 {
86 this.refDocRefer = refDocReferIn;
87 }
88
89 private Date refDocDt;
90
91
92
93
94
95 public Date getRefDocDt()
96 {
97 return this.refDocDt;
98 }
99
100
101
102
103
104 public void setRefDocDt(Date refDocDtIn)
105 {
106 this.refDocDt = refDocDtIn;
107 }
108
109 private String refDocCm;
110
111
112
113
114
115 public String getRefDocCm()
116 {
117 return this.refDocCm;
118 }
119
120
121
122
123
124 public void setRefDocCm(String refDocCmIn)
125 {
126 this.refDocCm = refDocCmIn;
127 }
128
129 private Date refDocCreationDt;
130
131
132
133
134
135 public Date getRefDocCreationDt()
136 {
137 return this.refDocCreationDt;
138 }
139
140
141
142
143
144 public void setRefDocCreationDt(Date refDocCreationDtIn)
145 {
146 this.refDocCreationDt = refDocCreationDtIn;
147 }
148
149 private Timestamp updateDt;
150
151
152
153
154
155 public Timestamp getUpdateDt()
156 {
157 return this.updateDt;
158 }
159
160
161
162
163
164 public void setUpdateDt(Timestamp updateDtIn)
165 {
166 this.updateDt = updateDtIn;
167 }
168
169
170 private Status status;
171
172
173
174
175
176 public Status getStatus()
177 {
178 return this.status;
179 }
180
181
182
183
184
185 public void setStatus(Status statusIn)
186 {
187 this.status = statusIn;
188 }
189
190 private Collection<Author> authors = new HashSet<Author>();
191
192
193
194
195
196 public Collection<Author> getAuthors()
197 {
198 return this.authors;
199 }
200
201
202
203
204
205 public void setAuthors(Collection<Author> authorsIn)
206 {
207 this.authors = authorsIn;
208 }
209
210
211
212
213
214
215
216 public boolean addAuthors(Author elementToAdd)
217 {
218 return this.authors.add(elementToAdd);
219 }
220
221
222
223
224
225
226
227 public boolean removeAuthors(Author elementToRemove)
228 {
229 return this.authors.remove(elementToRemove);
230 }
231
232
233
234
235
236 @Override
237 public boolean equals(Object object)
238 {
239 if (this == object)
240 {
241 return true;
242 }
243 if (!(object instanceof ReferenceDocument))
244 {
245 return false;
246 }
247 final ReferenceDocument that = (ReferenceDocument)object;
248 if (this.refDocId == null || that.getRefDocId() == null || !this.refDocId.equals(that.getRefDocId()))
249 {
250 return false;
251 }
252 return true;
253 }
254
255
256
257
258 @Override
259 public int hashCode()
260 {
261 int hashCode = 0;
262 hashCode = 29 * hashCode + (this.refDocId == null ? 0 : this.refDocId.hashCode());
263
264 return hashCode;
265 }
266
267
268
269
270 public static final class Factory
271 {
272
273
274
275
276 public static ReferenceDocument newInstance()
277 {
278 return new ReferenceDocumentImpl();
279 }
280
281
282
283
284
285
286
287
288 public static ReferenceDocument newInstance(Timestamp updateDt, Status status)
289 {
290 final ReferenceDocument entity = new ReferenceDocumentImpl();
291 entity.setUpdateDt(updateDt);
292 entity.setStatus(status);
293 return entity;
294 }
295
296
297
298
299
300
301
302
303
304
305
306
307
308 public static ReferenceDocument newInstance(String refDocRefer, Date refDocDt, String refDocCm, Date refDocCreationDt, Timestamp updateDt, Status status, Collection<Author> authors)
309 {
310 final ReferenceDocument entity = new ReferenceDocumentImpl();
311 entity.setRefDocRefer(refDocRefer);
312 entity.setRefDocDt(refDocDt);
313 entity.setRefDocCm(refDocCm);
314 entity.setRefDocCreationDt(refDocCreationDt);
315 entity.setUpdateDt(updateDt);
316 entity.setStatus(status);
317 entity.setAuthors(authors);
318 return entity;
319 }
320 }
321
322
323
324
325 public int compareTo(ReferenceDocument o)
326 {
327 int cmp = 0;
328 if (this.getRefDocId() != null)
329 {
330 cmp = this.getRefDocId().compareTo(o.getRefDocId());
331 }
332 else
333 {
334 if (this.getRefDocRefer() != null)
335 {
336 cmp = (cmp != 0 ? cmp : this.getRefDocRefer().compareTo(o.getRefDocRefer()));
337 }
338 if (this.getRefDocDt() != null)
339 {
340 cmp = (cmp != 0 ? cmp : this.getRefDocDt().compareTo(o.getRefDocDt()));
341 }
342 if (this.getRefDocCm() != null)
343 {
344 cmp = (cmp != 0 ? cmp : this.getRefDocCm().compareTo(o.getRefDocCm()));
345 }
346 if (this.getRefDocCreationDt() != null)
347 {
348 cmp = (cmp != 0 ? cmp : this.getRefDocCreationDt().compareTo(o.getRefDocCreationDt()));
349 }
350 if (this.getUpdateDt() != null)
351 {
352 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
353 }
354 }
355 return cmp;
356 }
357
358
359 }