1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
5 //
6 package fr.ifremer.quadrige3.core.dao.referential.taxon;
7
8 /*-
9 * #%L
10 * Quadrige3 Core :: Client API
11 * %%
12 * Copyright (C) 2017 - 2024 Ifremer
13 * %%
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * #L%
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 * Liste les documents de référence concernant un taxon.
37 */
38 // HibernateEntity.vsl annotations merge-point
39 public abstract class ReferenceDocument
40 implements Serializable, Comparable<ReferenceDocument>
41 {
42 /**
43 * The serial version UID of this class. Needed for serialization.
44 */
45 private static final long serialVersionUID = 5245706815407059828L;
46
47 // Generate 6 attributes
48 private Integer refDocId;
49
50 /**
51 * Identifiant interne de la publication
52 * @return this.refDocId Integer
53 */
54 public Integer getRefDocId()
55 {
56 return this.refDocId;
57 }
58
59 /**
60 * Identifiant interne de la publication
61 * @param refDocIdIn Integer
62 */
63 public void setRefDocId(Integer refDocIdIn)
64 {
65 this.refDocId = refDocIdIn;
66 }
67
68 private String refDocRefer;
69
70 /**
71 * Référence de la publication (revue, titre, page, ...)
72 * @return this.refDocRefer String
73 */
74 public String getRefDocRefer()
75 {
76 return this.refDocRefer;
77 }
78
79 /**
80 * Référence de la publication (revue, titre, page, ...)
81 * @param refDocReferIn String
82 */
83 public void setRefDocRefer(String refDocReferIn)
84 {
85 this.refDocRefer = refDocReferIn;
86 }
87
88 private Date refDocDt;
89
90 /**
91 * Date de parution du document
92 * @return this.refDocDt Date
93 */
94 public Date getRefDocDt()
95 {
96 return this.refDocDt;
97 }
98
99 /**
100 * Date de parution du document
101 * @param refDocDtIn Date
102 */
103 public void setRefDocDt(Date refDocDtIn)
104 {
105 this.refDocDt = refDocDtIn;
106 }
107
108 private String refDocCm;
109
110 /**
111 * Commentaire sur la publication
112 * @return this.refDocCm String
113 */
114 public String getRefDocCm()
115 {
116 return this.refDocCm;
117 }
118
119 /**
120 * Commentaire sur la publication
121 * @param refDocCmIn String
122 */
123 public void setRefDocCm(String refDocCmIn)
124 {
125 this.refDocCm = refDocCmIn;
126 }
127
128 private Date refDocCreationDt;
129
130 /**
131 * Date de création de l'objet
132 * @return this.refDocCreationDt Date
133 */
134 public Date getRefDocCreationDt()
135 {
136 return this.refDocCreationDt;
137 }
138
139 /**
140 * Date de création de l'objet
141 * @param refDocCreationDtIn Date
142 */
143 public void setRefDocCreationDt(Date refDocCreationDtIn)
144 {
145 this.refDocCreationDt = refDocCreationDtIn;
146 }
147
148 private Timestamp updateDt;
149
150 /**
151 * Date de maj de l'objet
152 * @return this.updateDt Timestamp
153 */
154 public Timestamp getUpdateDt()
155 {
156 return this.updateDt;
157 }
158
159 /**
160 * Date de maj de l'objet
161 * @param updateDtIn Timestamp
162 */
163 public void setUpdateDt(Timestamp updateDtIn)
164 {
165 this.updateDt = updateDtIn;
166 }
167
168 // Generate 5 associations
169 private Status status;
170
171 /**
172 * Liste des états possibles d'un objet.
173 * @return this.status Status
174 */
175 public Status getStatus()
176 {
177 return this.status;
178 }
179
180 /**
181 * Liste des états possibles d'un objet.
182 * @param statusIn Status
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 * Liste, au niveau de la taxinomie, des scientifiques à l'origine de la nomenclature.
193 * @return this.authors Collection<Author>
194 */
195 public Collection<Author> getAuthors()
196 {
197 return this.authors;
198 }
199
200 /**
201 * Liste, au niveau de la taxinomie, des scientifiques à l'origine de la nomenclature.
202 * @param authorsIn Collection<Author>
203 */
204 public void setAuthors(Collection<Author> authorsIn)
205 {
206 this.authors = authorsIn;
207 }
208
209 /**
210 * Liste, au niveau de la taxinomie, des scientifiques à l'origine de la nomenclature.
211 * @param elementToAdd Author
212 * @return <tt>true</tt> if this collection changed as a result of the
213 * call
214 */
215 public boolean addAuthors(Author elementToAdd)
216 {
217 return this.authors.add(elementToAdd);
218 }
219
220 /**
221 * Liste, au niveau de la taxinomie, des scientifiques à l'origine de la nomenclature.
222 * @param elementToRemove Author
223 * @return <tt>true</tt> if this collection changed as a result of the
224 * call
225 */
226 public boolean removeAuthors(Author elementToRemove)
227 {
228 return this.authors.remove(elementToRemove);
229 }
230
231 /**
232 * Returns <code>true</code> if the argument is an ReferenceDocument instance and all identifiers for this entity
233 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
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 * Returns a hash code based on this entity's identifiers.
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 * Constructs new instances of {@link ReferenceDocument}.
268 */
269 public static final class Factory
270 {
271 /**
272 * Constructs a new instance of {@link ReferenceDocument}.
273 * @return new ReferenceDocumentImpl()
274 */
275 public static ReferenceDocument newInstance()
276 {
277 return new ReferenceDocumentImpl();
278 }
279
280 /**
281 * Constructs a new instance of {@link ReferenceDocument}, taking all required and/or
282 * read-only properties as arguments, except for identifiers.
283 * @param status Status
284 * @return newInstance
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 * Constructs a new instance of {@link ReferenceDocument}, taking all possible properties
295 * (except the identifier(s))as arguments.
296 * @param refDocRefer String
297 * @param refDocDt Date
298 * @param refDocCm String
299 * @param refDocCreationDt Date
300 * @param updateDt Timestamp
301 * @param status Status
302 * @param authors Collection<Author>
303 * @return newInstance ReferenceDocument
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 * @see Comparable#compareTo
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 // HibernateEntity.vsl merge-point
355 // ReferenceDocument.java merge-point
356 }