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