1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: SpringDao.vsl in andromda-spring-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.Search;
29 import java.sql.Timestamp;
30 import java.util.Collection;
31 import java.util.Set;
32 import org.andromda.spring.PaginationResult;
33
34 /**
35 * Liste des taxons qui sont la référence.
36 * l'ID référent est indépendant des ID taxon car les taxons peuvent être référents à un moment et
37 * ne plus l'être par la suite.
38 * Toutes les données du système doivent donc être reliées au référent et non au taxon qui sont
39 * référents à un moment mais ne peuvent plus l'être par la suite.
40 * Le fonctionnement dans la table TAXON_NAME est le suivant :
41 * - REF_TAXON_ID est toujours renseigné
42 * - si TAXON_NAME_IS_REFER est à vrai, il s'agit d'un taxon référent (toujours le cas s'il s'agit
43 * d'un taxon virtuel)
44 * - sinon c'est un synonyme
45 * Un taxon référent qui devient synonyme voit donc son statut TAXON_NAME_IS_REFER changer et le
46 * nouveau taxon référent qui le remplace récupère l'information REF_TAXON_ID
47 * NB : c'était le comportement initialement prévu.
48 * En réalité, lorsqu'un taxon référent T1-R1 devient synonyme d'un nouveau taxon référent T2, le
49 * taxon T2 prend un nouveau code référent R2 et donc le taxon T1 est lié à R2 (et tous les
50 * synonymes et les résultats qu'il pouvait avoir).
51 * Ce mécanisme a été adopté car il fallait distinguer 2 cas :
52 * 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
53 * alors pu utiliser le même REF_TAXON_ID R1 au lieu d'en créer un et ne pas mettre à jour les
54 * autres synonymes, résultats...
55 * 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 qui
56 * aurait déjà d'autres synonymes, résultats...), dans ce cas le remplacement de la référence R1
57 * pour R2 est nécessaire
58 * La modélisation pourrait être revue car la table REFENCE_TAXON ne se justifie alors plus, on
59 * pourrait directement utiliser une référence à la colonne TAXON_NAME_ID pour désigner les
60 * référents
61 * @see ReferenceTaxon
62 */
63 public interface ReferenceTaxonDao
64 {
65 /**
66 * This constant is used as a transformation flag; entities can be converted automatically into value objects
67 * or other types, different methods in a class implementing this interface support this feature: look for
68 * an <code>int</code> parameter called <code>transform</code>.
69 * <p>
70 * This specific flag denotes no transformation will occur.
71 */
72 public static final int TRANSFORM_NONE = 0;
73
74
75 /**
76 * Transforms the given results to a collection of {@link ReferenceTaxon}
77 * instances (this is useful when the returned results contains a row of data and you want just entities only).
78 *
79 * @param results the query results.
80 */
81 public void toEntities(final Collection<?> results);
82
83 /**
84 * Gets an instance of ReferenceTaxon from the persistent store.
85 * @param refTaxonId
86 * @return ReferenceTaxon
87 */
88 public ReferenceTaxon get(Integer refTaxonId);
89
90 /**
91 * <p>
92 * Does the same thing as {@link #get(Integer)} with an
93 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
94 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
95 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
96 * optionally transform the entity (into a value object for example). By default, transformation does
97 * not occur.
98 * </p>
99 *
100 * @param transform flag to determine transformation type.
101 * @param refTaxonId the identifier of the entity to get.
102 * @return either the entity or the object transformed from the entity.
103 */
104 public Object get(int transform, Integer refTaxonId);
105
106 /**
107 * Loads an instance of ReferenceTaxon from the persistent store.
108 * @param refTaxonId
109 * @return ReferenceTaxon
110 */
111 public ReferenceTaxon load(Integer refTaxonId);
112
113 /**
114 * <p>
115 * Does the same thing as {@link #load(Integer)} with an
116 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
117 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
118 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
119 * optionally transform the entity (into a value object for example). By default, transformation does
120 * not occur.
121 * </p>
122 *
123 * @param transform flag to determine transformation type.
124 * @param refTaxonId the identifier of the entity to load.
125 * @return either the entity or the object transformed from the entity.
126 */
127 public Object load(int transform, Integer refTaxonId);
128
129 /**
130 * Loads all entities of type {@link ReferenceTaxon}.
131 *
132 * @return the loaded entities.
133 */
134 public Collection<ReferenceTaxon> loadAll();
135
136 /**
137 * <p>
138 * Does the same thing as {@link #loadAll()} with an
139 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
140 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
141 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
142 * transform the entity (into a value object for example). By default, transformation does
143 * not occur.
144 * </p>
145 *
146 * @param transform the flag indicating what transformation to use.
147 * @return the loaded entities.
148 */
149 public Collection<?> loadAll(final int transform);
150
151 /**
152 * <p>
153 * Does the same thing as {@link #loadAll()} with an
154 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
155 * argument allows you to specify the page number when you are paging the results and the pageSize allows you to specify the size of the
156 * page retrieved.
157 * </p>
158 *
159 * @param pageNumber the page number to retrieve when paging results.
160 * @param pageSize the size of the page to retrieve when paging results.
161 * @return the loaded entities.
162 */
163 public Collection<?> loadAll(final int pageNumber, final int pageSize);
164
165 /**
166 * <p>
167 * Does the same thing as {@link #loadAll(int)} with an
168 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
169 * argument allows you to specify the page number when you are paging the results and the pageSize allows you to specify the size of the
170 * page retrieved.
171 * </p>
172 *
173 * @param transform the flag indicating what transformation to use.
174 * @param pageNumber the page number to retrieve when paging results.
175 * @param pageSize the size of the page to retrieve when paging results.
176 * @return the loaded entities.
177 */
178 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
179
180 /**
181 * Creates an instance of ReferenceTaxon and adds it to the persistent store.
182 * @param referenceTaxon
183 * @return ReferenceTaxon
184 */
185 public ReferenceTaxon create(ReferenceTaxon referenceTaxon);
186
187 /**
188 * <p>
189 * Does the same thing as {@link #create(ReferenceTaxon)} with an
190 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
191 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
192 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
193 * transform the entity (into a value object for example). By default, transformation does
194 * not occur.
195 * </p>
196 * @param transform
197 * @param referenceTaxon
198 * @return Object
199 */
200 public Object create(int transform, ReferenceTaxon referenceTaxon);
201
202 /**
203 * Creates a new instance of ReferenceTaxon and adds
204 * from the passed in <code>entities</code> collection
205 *
206 * @param entities the collection of ReferenceTaxon
207 * instances to create.
208 *
209 * @return the created instances.
210 */
211 public Collection<ReferenceTaxon> create(Collection<ReferenceTaxon> entities);
212
213 /**
214 * <p>
215 * Does the same thing as {@link #create(ReferenceTaxon)} with an
216 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
217 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
218 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
219 * transform the entities (into value objects for example). By default, transformation does
220 * not occur.
221 * </p>
222 * @param transform
223 * @param entities
224 * @return Collection
225 */
226 public Collection<?> create(int transform, Collection<ReferenceTaxon> entities);
227
228 /**
229 * <p>
230 * Creates a new <code>ReferenceTaxon</code>
231 * instance from <strong>all</strong> attributes and adds it to
232 * the persistent store.
233 * </p>
234 * @param updateDt Date de modification de l'objet, mise à jour par le système
235 * @return ReferenceTaxon
236 */
237 public ReferenceTaxon create(
238 Timestamp updateDt);
239
240 /**
241 * <p>
242 * Does the same thing as {@link #create(Timestamp)} with an
243 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
244 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
245 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
246 * transform the entity (into a value object for example). By default, transformation does
247 * not occur.
248 * </p>
249 * @param transform
250 * @param updateDt Date de modification de l'objet, mise à jour par le système
251 * @return ReferenceTaxon
252 */
253 public Object create(
254 int transform,
255 Timestamp updateDt);
256
257
258 /**
259 * Updates the <code>referenceTaxon</code> instance in the persistent store.
260 * @param referenceTaxon
261 */
262 public void update(ReferenceTaxon referenceTaxon);
263
264 /**
265 * Updates all instances in the <code>entities</code> collection in the persistent store.
266 * @param entities
267 */
268 public void update(Collection<ReferenceTaxon> entities);
269
270 /**
271 * Removes the instance of ReferenceTaxon from the persistent store.
272 * @param referenceTaxon
273 */
274 public void remove(ReferenceTaxon referenceTaxon);
275
276 /**
277 * Removes the instance of ReferenceTaxon having the given
278 * <code>identifier</code> from the persistent store.
279 * @param refTaxonId
280 */
281 public void remove(Integer refTaxonId);
282
283 /**
284 * Removes all entities in the given <code>entities</code> collection.
285 * @param entities
286 */
287 public void remove(Collection<ReferenceTaxon> entities);
288
289
290 /**
291 * Does the same thing as {@link #search(int, Search)} but with an
292 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
293 * limit your data to a specified page number and size.
294 *
295 * @param transform the transformation flag.
296 * @param pageNumber the page number in the data to retrieve
297 * @param pageSize the size of the page to retrieve.
298 * @param search the search object which provides the search parameters and pagination specification.
299 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
300 */
301 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
302
303 /**
304 * Does the same thing as {@link #search(Search)} but with an
305 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
306 * limit your data to a specified page number and size.
307 *
308 * @param pageNumber the page number in the data to retrieve
309 * @param pageSize the size of the page to retrieve.
310 * @param search the search object which provides the search parameters and pagination specification.
311 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
312 */
313 public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
314
315 /**
316 * Does the same thing as {@link #search(Search)} but with an
317 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
318 * finder results will <strong>NOT</strong> be transformed during retrieval.
319 * If this flag is any of the other constants defined here
320 * then results <strong>WILL BE</strong> passed through an operation which can optionally
321 * transform the entities (into value objects for example). By default, transformation does
322 * not occur.
323 *
324 * @param transform the transformation flag.
325 * @param search the search object which provides the search parameters and pagination specification.
326 * @return any found results from the search.
327 */
328 public Set<?> search(final int transform, final Search search);
329
330 /**
331 * Performs a search using the parameters specified in the given <code>search</code> object.
332 *
333 * @param search the search object which provides the search parameters and pagination specification.
334 * @return any found results from the search.
335 */
336 public Set<ReferenceTaxon> search(final Search search);
337
338 /**
339 * Allows transformation of entities into value objects
340 * (or something else for that matter), when the <code>transform</code>
341 * flag is set to one of the constants defined in <code>fr.ifremer.quadrige3.core.dao.referential.taxon.ReferenceTaxonDao</code>, please note
342 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
343 * will be returned.
344 *
345 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
346 *
347 * @param transform one of the constants declared in {@link fr.ifremer.quadrige3.core.dao.referential.taxon.ReferenceTaxonDao}
348 * @param entity an entity that was found
349 * @return the transformed entity (i.e. new value object, etc)
350 * @see #transformEntities(int,Collection)
351 */
352 public Object transformEntity(final int transform, final ReferenceTaxon entity);
353
354 /**
355 * Transforms a collection of entities using the
356 * {@link #transformEntity(int,ReferenceTaxon)}
357 * method. This method does not instantiate a new collection.
358 * <p>
359 * This method is to be used internally only.
360 *
361 * @param transform one of the constants declared in <code>fr.ifremer.quadrige3.core.dao.referential.taxon.ReferenceTaxonDao</code>
362 * @param entities the collection of entities to transform
363 * @see #transformEntity(int,ReferenceTaxon)
364 */
365 public void transformEntities(final int transform, final Collection<?> entities);
366
367 // spring-dao merge-point
368 }