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.quadrige2.core.dao.referential.taxon;
7
8 /*-
9 * #%L
10 * Quadrige2 Core :: Server API
11 * %%
12 * Copyright (C) 2017 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
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 * Citation faisant référence pour un taxon particulier.
38 */
39 // HibernateEntity.vsl annotations merge-point
40 public abstract class Citation
41 implements Serializable, Comparable<Citation>
42 {
43 /**
44 * The serial version UID of this class. Needed for serialization.
45 */
46 private static final long serialVersionUID = -1076349412632982927L;
47
48 // Generate 4 attributes
49 private Integer citId;
50
51 /**
52 * Identifiant interne de la citation
53 * @return this.citId Integer
54 */
55 public Integer getCitId()
56 {
57 return this.citId;
58 }
59
60 /**
61 * Identifiant interne de la citation
62 * @param citIdIn Integer
63 */
64 public void setCitId(Integer citIdIn)
65 {
66 this.citId = citIdIn;
67 }
68
69 private String citNm;
70
71 /**
72 * Libellé de la citation
73 * @return this.citNm String
74 */
75 public String getCitNm()
76 {
77 return this.citNm;
78 }
79
80 /**
81 * Libellé de la citation
82 * @param citNmIn String
83 */
84 public void setCitNm(String citNmIn)
85 {
86 this.citNm = citNmIn;
87 }
88
89 private Date citCreationDt;
90
91 /**
92 * Date de création de l'objet
93 * @return this.citCreationDt Date
94 */
95 public Date getCitCreationDt()
96 {
97 return this.citCreationDt;
98 }
99
100 /**
101 * Date de création de l'objet
102 * @param citCreationDtIn Date
103 */
104 public void setCitCreationDt(Date citCreationDtIn)
105 {
106 this.citCreationDt = citCreationDtIn;
107 }
108
109 private Timestamp updateDt;
110
111 /**
112 * Date de maj de l'objet
113 * @return this.updateDt Timestamp
114 */
115 public Timestamp getUpdateDt()
116 {
117 return this.updateDt;
118 }
119
120 /**
121 * Date de maj de l'objet
122 * @param updateDtIn Timestamp
123 */
124 public void setUpdateDt(Timestamp updateDtIn)
125 {
126 this.updateDt = updateDtIn;
127 }
128
129 // Generate 3 associations
130 private Collection<TaxonName> taxonNames = new HashSet<TaxonName>();
131
132 /**
133 * Liste les taxons (interface avec ERMS)
134 * @return this.taxonNames Collection<TaxonName>
135 */
136 public Collection<TaxonName> getTaxonNames()
137 {
138 return this.taxonNames;
139 }
140
141 /**
142 * Liste les taxons (interface avec ERMS)
143 * @param taxonNamesIn Collection<TaxonName>
144 */
145 public void setTaxonNames(Collection<TaxonName> taxonNamesIn)
146 {
147 this.taxonNames = taxonNamesIn;
148 }
149
150 /**
151 * Liste les taxons (interface avec ERMS)
152 * @param elementToAdd TaxonName
153 * @return <tt>true</tt> if this collection changed as a result of the
154 * call
155 */
156 public boolean addTaxonNames(TaxonName elementToAdd)
157 {
158 return this.taxonNames.add(elementToAdd);
159 }
160
161 /**
162 * Liste les taxons (interface avec ERMS)
163 * @param elementToRemove TaxonName
164 * @return <tt>true</tt> if this collection changed as a result of the
165 * call
166 */
167 public boolean removeTaxonNames(TaxonName elementToRemove)
168 {
169 return this.taxonNames.remove(elementToRemove);
170 }
171
172 private Status status;
173
174 /**
175 * Liste des états possibles d'un objet.
176 * @return this.status Status
177 */
178 public Status getStatus()
179 {
180 return this.status;
181 }
182
183 /**
184 * Liste des états possibles d'un objet.
185 * @param statusIn Status
186 */
187 public void setStatus(Status statusIn)
188 {
189 this.status = statusIn;
190 }
191
192 private Collection<TaxonNameHistory> taxonNameHistIds = new HashSet<TaxonNameHistory>();
193
194 /**
195 * Cette table permet de conserver l'historique des modifications d'un taxon
196 * @return this.taxonNameHistIds Collection<TaxonNameHistory>
197 */
198 public Collection<TaxonNameHistory> getTaxonNameHistIds()
199 {
200 return this.taxonNameHistIds;
201 }
202
203 /**
204 * Cette table permet de conserver l'historique des modifications d'un taxon
205 * @param taxonNameHistIdsIn Collection<TaxonNameHistory>
206 */
207 public void setTaxonNameHistIds(Collection<TaxonNameHistory> taxonNameHistIdsIn)
208 {
209 this.taxonNameHistIds = taxonNameHistIdsIn;
210 }
211
212 /**
213 * Cette table permet de conserver l'historique des modifications d'un taxon
214 * @param elementToAdd TaxonNameHistory
215 * @return <tt>true</tt> if this collection changed as a result of the
216 * call
217 */
218 public boolean addTaxonNameHistIds(TaxonNameHistory elementToAdd)
219 {
220 return this.taxonNameHistIds.add(elementToAdd);
221 }
222
223 /**
224 * Cette table permet de conserver l'historique des modifications d'un taxon
225 * @param elementToRemove TaxonNameHistory
226 * @return <tt>true</tt> if this collection changed as a result of the
227 * call
228 */
229 public boolean removeTaxonNameHistIds(TaxonNameHistory elementToRemove)
230 {
231 return this.taxonNameHistIds.remove(elementToRemove);
232 }
233
234 /**
235 * Returns <code>true</code> if the argument is an Citation instance and all identifiers for this entity
236 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
237 */
238 @Override
239 public boolean equals(Object object)
240 {
241 if (this == object)
242 {
243 return true;
244 }
245 if (!(object instanceof Citation))
246 {
247 return false;
248 }
249 final Citation that = (Citation)object;
250 if (this.citId == null || that.getCitId() == null || !this.citId.equals(that.getCitId()))
251 {
252 return false;
253 }
254 return true;
255 }
256
257 /**
258 * Returns a hash code based on this entity's identifiers.
259 */
260 @Override
261 public int hashCode()
262 {
263 int hashCode = 0;
264 hashCode = 29 * hashCode + (this.citId == null ? 0 : this.citId.hashCode());
265
266 return hashCode;
267 }
268
269 /**
270 * Constructs new instances of {@link Citation}.
271 */
272 public static final class Factory
273 {
274 /**
275 * Constructs a new instance of {@link Citation}.
276 * @return new CitationImpl()
277 */
278 public static Citation newInstance()
279 {
280 return new CitationImpl();
281 }
282
283 /**
284 * Constructs a new instance of {@link Citation}, taking all required and/or
285 * read-only properties as arguments, except for identifiers.
286 * @param updateDt Timestamp
287 * @param status Status
288 * @return newInstance
289 */
290 public static Citation newInstance(Timestamp updateDt, Status status)
291 {
292 final Citation entity = new CitationImpl();
293 entity.setUpdateDt(updateDt);
294 entity.setStatus(status);
295 return entity;
296 }
297
298 /**
299 * Constructs a new instance of {@link Citation}, taking all possible properties
300 * (except the identifier(s))as arguments.
301 * @param citNm String
302 * @param citCreationDt Date
303 * @param updateDt Timestamp
304 * @param taxonNames Collection<TaxonName>
305 * @param status Status
306 * @param taxonNameHistIds Collection<TaxonNameHistory>
307 * @return newInstance Citation
308 */
309 public static Citation newInstance(String citNm, Date citCreationDt, Timestamp updateDt, Collection<TaxonName> taxonNames, Status status, Collection<TaxonNameHistory> taxonNameHistIds)
310 {
311 final Citation entity = new CitationImpl();
312 entity.setCitNm(citNm);
313 entity.setCitCreationDt(citCreationDt);
314 entity.setUpdateDt(updateDt);
315 entity.setTaxonNames(taxonNames);
316 entity.setStatus(status);
317 entity.setTaxonNameHistIds(taxonNameHistIds);
318 return entity;
319 }
320 }
321
322 /**
323 * @see Comparable#compareTo
324 */
325 public int compareTo(Citation o)
326 {
327 int cmp = 0;
328 if (this.getCitId() != null)
329 {
330 cmp = this.getCitId().compareTo(o.getCitId());
331 }
332 else
333 {
334 if (this.getCitNm() != null)
335 {
336 cmp = (cmp != 0 ? cmp : this.getCitNm().compareTo(o.getCitNm()));
337 }
338 if (this.getCitCreationDt() != null)
339 {
340 cmp = (cmp != 0 ? cmp : this.getCitCreationDt().compareTo(o.getCitCreationDt()));
341 }
342 if (this.getUpdateDt() != null)
343 {
344 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
345 }
346 }
347 return cmp;
348 }
349 // HibernateEntity.vsl merge-point
350 // Citation.java merge-point
351 }