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