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 * Citation faisant référence pour un taxon particulier.
37 */
38 // HibernateEntity.vsl annotations merge-point
39 public abstract class Citation
40 implements Serializable, Comparable<Citation>
41 {
42 /**
43 * The serial version UID of this class. Needed for serialization.
44 */
45 private static final long serialVersionUID = -1076349412632982927L;
46
47 // Generate 4 attributes
48 private Integer citId;
49
50 /**
51 * Identifiant interne de la citation
52 * @return this.citId Integer
53 */
54 public Integer getCitId()
55 {
56 return this.citId;
57 }
58
59 /**
60 * Identifiant interne de la citation
61 * @param citIdIn Integer
62 */
63 public void setCitId(Integer citIdIn)
64 {
65 this.citId = citIdIn;
66 }
67
68 private String citNm;
69
70 /**
71 * Libellé de la citation
72 * @return this.citNm String
73 */
74 public String getCitNm()
75 {
76 return this.citNm;
77 }
78
79 /**
80 * Libellé de la citation
81 * @param citNmIn String
82 */
83 public void setCitNm(String citNmIn)
84 {
85 this.citNm = citNmIn;
86 }
87
88 private Date citCreationDt;
89
90 /**
91 * Date de création de l'objet
92 * @return this.citCreationDt Date
93 */
94 public Date getCitCreationDt()
95 {
96 return this.citCreationDt;
97 }
98
99 /**
100 * Date de création de l'objet
101 * @param citCreationDtIn Date
102 */
103 public void setCitCreationDt(Date citCreationDtIn)
104 {
105 this.citCreationDt = citCreationDtIn;
106 }
107
108 private Timestamp updateDt;
109
110 /**
111 * Date de maj de l'objet
112 * @return this.updateDt Timestamp
113 */
114 public Timestamp getUpdateDt()
115 {
116 return this.updateDt;
117 }
118
119 /**
120 * Date de maj de l'objet
121 * @param updateDtIn Timestamp
122 */
123 public void setUpdateDt(Timestamp updateDtIn)
124 {
125 this.updateDt = updateDtIn;
126 }
127
128 // Generate 3 associations
129 private Collection<TaxonName> taxonNames = new HashSet<TaxonName>();
130
131 /**
132 * Liste les taxons (interface avec ERMS)
133 * @return this.taxonNames Collection<TaxonName>
134 */
135 public Collection<TaxonName> getTaxonNames()
136 {
137 return this.taxonNames;
138 }
139
140 /**
141 * Liste les taxons (interface avec ERMS)
142 * @param taxonNamesIn Collection<TaxonName>
143 */
144 public void setTaxonNames(Collection<TaxonName> taxonNamesIn)
145 {
146 this.taxonNames = taxonNamesIn;
147 }
148
149 /**
150 * Liste les taxons (interface avec ERMS)
151 * @param elementToAdd TaxonName
152 * @return <tt>true</tt> if this collection changed as a result of the
153 * call
154 */
155 public boolean addTaxonNames(TaxonName elementToAdd)
156 {
157 return this.taxonNames.add(elementToAdd);
158 }
159
160 /**
161 * Liste les taxons (interface avec ERMS)
162 * @param elementToRemove TaxonName
163 * @return <tt>true</tt> if this collection changed as a result of the
164 * call
165 */
166 public boolean removeTaxonNames(TaxonName elementToRemove)
167 {
168 return this.taxonNames.remove(elementToRemove);
169 }
170
171 private Status status;
172
173 /**
174 * Liste des états possibles d'un objet.
175 * @return this.status Status
176 */
177 public Status getStatus()
178 {
179 return this.status;
180 }
181
182 /**
183 * Liste des états possibles d'un objet.
184 * @param statusIn Status
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 * Cette table permet de conserver l'historique des modifications d'un taxon
195 * @return this.taxonNameHistIds Collection<TaxonNameHistory>
196 */
197 public Collection<TaxonNameHistory> getTaxonNameHistIds()
198 {
199 return this.taxonNameHistIds;
200 }
201
202 /**
203 * Cette table permet de conserver l'historique des modifications d'un taxon
204 * @param taxonNameHistIdsIn Collection<TaxonNameHistory>
205 */
206 public void setTaxonNameHistIds(Collection<TaxonNameHistory> taxonNameHistIdsIn)
207 {
208 this.taxonNameHistIds = taxonNameHistIdsIn;
209 }
210
211 /**
212 * Cette table permet de conserver l'historique des modifications d'un taxon
213 * @param elementToAdd TaxonNameHistory
214 * @return <tt>true</tt> if this collection changed as a result of the
215 * call
216 */
217 public boolean addTaxonNameHistIds(TaxonNameHistory elementToAdd)
218 {
219 return this.taxonNameHistIds.add(elementToAdd);
220 }
221
222 /**
223 * Cette table permet de conserver l'historique des modifications d'un taxon
224 * @param elementToRemove TaxonNameHistory
225 * @return <tt>true</tt> if this collection changed as a result of the
226 * call
227 */
228 public boolean removeTaxonNameHistIds(TaxonNameHistory elementToRemove)
229 {
230 return this.taxonNameHistIds.remove(elementToRemove);
231 }
232
233 /**
234 * Returns <code>true</code> if the argument is an Citation instance and all identifiers for this entity
235 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
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 * Returns a hash code based on this entity's identifiers.
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 * Constructs new instances of {@link Citation}.
270 */
271 public static final class Factory
272 {
273 /**
274 * Constructs a new instance of {@link Citation}.
275 * @return new CitationImpl()
276 */
277 public static Citation newInstance()
278 {
279 return new CitationImpl();
280 }
281
282 /**
283 * Constructs a new instance of {@link Citation}, taking all required and/or
284 * read-only properties as arguments, except for identifiers.
285 * @param status Status
286 * @return newInstance
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 * Constructs a new instance of {@link Citation}, taking all possible properties
297 * (except the identifier(s))as arguments.
298 * @param citNm String
299 * @param citCreationDt Date
300 * @param updateDt Timestamp
301 * @param taxonNames Collection<TaxonName>
302 * @param status Status
303 * @param taxonNameHistIds Collection<TaxonNameHistory>
304 * @return newInstance Citation
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 * @see Comparable#compareTo
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 // HibernateEntity.vsl merge-point
347 // Citation.java merge-point
348 }