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.sandre;
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.taxon.ReferenceTaxon;
30 import java.io.Serializable;
31
32 /**
33 * Taxons sandre pour les imports de données
34 */
35 // HibernateEntity.vsl annotations merge-point
36 public abstract class SandreTaxonImp
37 implements Serializable, Comparable<SandreTaxonImp>
38 {
39 /**
40 * The serial version UID of this class. Needed for serialization.
41 */
42 private static final long serialVersionUID = -3554677237546541598L;
43
44 // Generate 4 attributes
45 private Integer sandreTaxonId;
46
47 /**
48 * Identifiant interne du taxon sandre
49 * @return this.sandreTaxonId Integer
50 */
51 public Integer getSandreTaxonId()
52 {
53 return this.sandreTaxonId;
54 }
55
56 /**
57 * Identifiant interne du taxon sandre
58 * @param sandreTaxonIdIn Integer
59 */
60 public void setSandreTaxonId(Integer sandreTaxonIdIn)
61 {
62 this.sandreTaxonId = sandreTaxonIdIn;
63 }
64
65 private String sandreTaxonLb;
66
67 /**
68 * Libellé du taxon sandre
69 * @return this.sandreTaxonLb String
70 */
71 public String getSandreTaxonLb()
72 {
73 return this.sandreTaxonLb;
74 }
75
76 /**
77 * Libellé du taxon sandre
78 * @param sandreTaxonLbIn String
79 */
80 public void setSandreTaxonLb(String sandreTaxonLbIn)
81 {
82 this.sandreTaxonLb = sandreTaxonLbIn;
83 }
84
85 private Integer extractSelGeomGeometryId;
86
87 /**
88 * Identifiant des objets sélectionnés
89 * @return this.extractSelGeomGeometryId Integer
90 */
91 public Integer getExtractSelGeomGeometryId()
92 {
93 return this.extractSelGeomGeometryId;
94 }
95
96 /**
97 * Identifiant des objets sélectionnés
98 * @param extractSelGeomGeometryIdIn Integer
99 */
100 public void setExtractSelGeomGeometryId(Integer extractSelGeomGeometryIdIn)
101 {
102 this.extractSelGeomGeometryId = extractSelGeomGeometryIdIn;
103 }
104
105 private Integer sandreTaxonImpId;
106
107 /**
108 *
109 * @return this.sandreTaxonImpId Integer
110 */
111 public Integer getSandreTaxonImpId()
112 {
113 return this.sandreTaxonImpId;
114 }
115
116 /**
117 *
118 * @param sandreTaxonImpIdIn Integer
119 */
120 public void setSandreTaxonImpId(Integer sandreTaxonImpIdIn)
121 {
122 this.sandreTaxonImpId = sandreTaxonImpIdIn;
123 }
124
125 // Generate 1 associations
126 private ReferenceTaxon refTaxonId;
127
128 /**
129 * Liste des taxons qui sont la référence.
130 * l'ID référent est indépendant des ID taxon car les taxons peuvent être référents à un moment
131 * et ne
132 * plus l'être par la suite.
133 * Toutes les données du système doivent donc être reliées au référent et non au taxon qui sont
134 * référents à un moment mais ne peuvent plus l'être par la suite.
135 * Le fonctionnement dans la table TAXON_NAME est le suivant :
136 * - REF_TAXON_ID est toujours renseigné
137 * - si TAXON_NAME_IS_REFER est à vrai, il s'agit d'un taxon référent (toujours le cas s'il
138 * s'agit d'un
139 * taxon virtuel)
140 * - sinon c'est un synonyme
141 * Un taxon référent qui devient synonyme voit donc son statut TAXON_NAME_IS_REFER changer et le
142 * nouveau taxon référent qui le remplace récupère l'information REF_TAXON_ID
143 * NB : c'était le comportement initialement prévu.
144 * En réalité, lorsqu'un taxon référent T1-R1 devient synonyme d'un nouveau taxon référent T2,
145 * le taxon
146 * T2 prend un nouveau code référent R2 et donc le taxon T1 est lié à R2 (et tous les synonymes
147 * et les
148 * résultats qu'il pouvait avoir).
149 * Ce mécanisme a été adopté car il fallait distinguer 2 cas :
150 * 1- cas d'un taxon référent T1-R1 qui devient synonyme d'un référent qu'on crée T2 : on aurait
151 * alors
152 * pu utiliser le même REF_TAXON_ID R1 au lieu d'en créer un et ne pas mettre à jour les autres
153 * synonymes, résultats...
154 * 2- cas d'un taxon référent T1-R1 qui devient synonyme d'un référent qui existe déjà T2-R2 (et
155 * qui
156 * aurait déjà d'autres synonymes, résultats...), dans ce cas le remplacement de la référence R1
157 * pour
158 * R2 est nécessaire
159 * La modélisation pourrait être revue car la table REFENCE_TAXON ne se justifie alors plus, on
160 * pourrait directement utiliser une référence à la colonne TAXON_NAME_ID pour désigner les
161 * référents
162 * @return this.refTaxonId ReferenceTaxon
163 */
164 public ReferenceTaxon getRefTaxonId()
165 {
166 return this.refTaxonId;
167 }
168
169 /**
170 * Liste des taxons qui sont la référence.
171 * l'ID référent est indépendant des ID taxon car les taxons peuvent être référents à un moment
172 * et ne
173 * plus l'être par la suite.
174 * Toutes les données du système doivent donc être reliées au référent et non au taxon qui sont
175 * référents à un moment mais ne peuvent plus l'être par la suite.
176 * Le fonctionnement dans la table TAXON_NAME est le suivant :
177 * - REF_TAXON_ID est toujours renseigné
178 * - si TAXON_NAME_IS_REFER est à vrai, il s'agit d'un taxon référent (toujours le cas s'il
179 * s'agit d'un
180 * taxon virtuel)
181 * - sinon c'est un synonyme
182 * Un taxon référent qui devient synonyme voit donc son statut TAXON_NAME_IS_REFER changer et le
183 * nouveau taxon référent qui le remplace récupère l'information REF_TAXON_ID
184 * NB : c'était le comportement initialement prévu.
185 * En réalité, lorsqu'un taxon référent T1-R1 devient synonyme d'un nouveau taxon référent T2,
186 * le taxon
187 * T2 prend un nouveau code référent R2 et donc le taxon T1 est lié à R2 (et tous les synonymes
188 * et les
189 * résultats qu'il pouvait avoir).
190 * Ce mécanisme a été adopté car il fallait distinguer 2 cas :
191 * 1- cas d'un taxon référent T1-R1 qui devient synonyme d'un référent qu'on crée T2 : on aurait
192 * alors
193 * pu utiliser le même REF_TAXON_ID R1 au lieu d'en créer un et ne pas mettre à jour les autres
194 * synonymes, résultats...
195 * 2- cas d'un taxon référent T1-R1 qui devient synonyme d'un référent qui existe déjà T2-R2 (et
196 * qui
197 * aurait déjà d'autres synonymes, résultats...), dans ce cas le remplacement de la référence R1
198 * pour
199 * R2 est nécessaire
200 * La modélisation pourrait être revue car la table REFENCE_TAXON ne se justifie alors plus, on
201 * pourrait directement utiliser une référence à la colonne TAXON_NAME_ID pour désigner les
202 * référents
203 * @param refTaxonIdIn ReferenceTaxon
204 */
205 public void setRefTaxonId(ReferenceTaxon refTaxonIdIn)
206 {
207 this.refTaxonId = refTaxonIdIn;
208 }
209
210 /**
211 * Returns <code>true</code> if the argument is an SandreTaxonImp instance and all identifiers for this entity
212 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
213 */
214 @Override
215 public boolean equals(Object object)
216 {
217 if (this == object)
218 {
219 return true;
220 }
221 if (!(object instanceof SandreTaxonImp))
222 {
223 return false;
224 }
225 final SandreTaxonImp that = (SandreTaxonImp)object;
226 if (this.sandreTaxonImpId == null || that.getSandreTaxonImpId() == null || !this.sandreTaxonImpId.equals(that.getSandreTaxonImpId()))
227 {
228 return false;
229 }
230 return true;
231 }
232
233 /**
234 * Returns a hash code based on this entity's identifiers.
235 */
236 @Override
237 public int hashCode()
238 {
239 int hashCode = 0;
240 hashCode = 29 * hashCode + (this.sandreTaxonImpId == null ? 0 : this.sandreTaxonImpId.hashCode());
241
242 return hashCode;
243 }
244
245 /**
246 * Constructs new instances of {@link SandreTaxonImp}.
247 */
248 public static final class Factory
249 {
250 /**
251 * Constructs a new instance of {@link SandreTaxonImp}.
252 * @return new SandreTaxonImpImpl()
253 */
254 public static SandreTaxonImp newInstance()
255 {
256 return new SandreTaxonImpImpl();
257 }
258
259 /**
260 * Constructs a new instance of {@link SandreTaxonImp}, taking all required and/or
261 * read-only properties as arguments, except for identifiers.
262 * @param sandreTaxonId Integer
263 * @param extractSelGeomGeometryId Integer
264 * @param refTaxonId ReferenceTaxon
265 * @return newInstance
266 */
267 public static SandreTaxonImp newInstance(Integer sandreTaxonId, Integer extractSelGeomGeometryId, ReferenceTaxon refTaxonId)
268 {
269 final SandreTaxonImp entity = new SandreTaxonImpImpl();
270 entity.setSandreTaxonId(sandreTaxonId);
271 entity.setExtractSelGeomGeometryId(extractSelGeomGeometryId);
272 entity.setRefTaxonId(refTaxonId);
273 return entity;
274 }
275
276 /**
277 * Constructs a new instance of {@link SandreTaxonImp}, taking all possible properties
278 * (except the identifier(s))as arguments.
279 * @param sandreTaxonId Integer
280 * @param sandreTaxonLb String
281 * @param extractSelGeomGeometryId Integer
282 * @param refTaxonId ReferenceTaxon
283 * @return newInstance SandreTaxonImp
284 */
285 public static SandreTaxonImp newInstance(Integer sandreTaxonId, String sandreTaxonLb, Integer extractSelGeomGeometryId, ReferenceTaxon refTaxonId)
286 {
287 final SandreTaxonImp entity = new SandreTaxonImpImpl();
288 entity.setSandreTaxonId(sandreTaxonId);
289 entity.setSandreTaxonLb(sandreTaxonLb);
290 entity.setExtractSelGeomGeometryId(extractSelGeomGeometryId);
291 entity.setRefTaxonId(refTaxonId);
292 return entity;
293 }
294 }
295
296 /**
297 * @see Comparable#compareTo
298 */
299 public int compareTo(SandreTaxonImp o)
300 {
301 int cmp = 0;
302 if (this.getSandreTaxonImpId() != null)
303 {
304 cmp = this.getSandreTaxonImpId().compareTo(o.getSandreTaxonImpId());
305 }
306 else
307 {
308 if (this.getSandreTaxonId() != null)
309 {
310 cmp = (cmp != 0 ? cmp : this.getSandreTaxonId().compareTo(o.getSandreTaxonId()));
311 }
312 if (this.getSandreTaxonLb() != null)
313 {
314 cmp = (cmp != 0 ? cmp : this.getSandreTaxonLb().compareTo(o.getSandreTaxonLb()));
315 }
316 if (this.getExtractSelGeomGeometryId() != null)
317 {
318 cmp = (cmp != 0 ? cmp : this.getExtractSelGeomGeometryId().compareTo(o.getExtractSelGeomGeometryId()));
319 }
320 }
321 return cmp;
322 }
323 // HibernateEntity.vsl merge-point
324 // SandreTaxonImp.java merge-point
325 }