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.data.sample;
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 fr.ifremer.quadrige3.core.dao.administration.user.Department;
30 import fr.ifremer.quadrige3.core.dao.data.samplingoperation.SamplingOperation;
31 import fr.ifremer.quadrige3.core.dao.referential.QualityFlag;
32 import fr.ifremer.quadrige3.core.dao.referential.pmfm.Matrix;
33 import java.sql.Timestamp;
34 import java.util.Collection;
35 import java.util.Date;
36 import java.util.Set;
37 import org.andromda.spring.PaginationResult;
38
39 /**
40 * Liste les échantillons prélevés lors d'un passage sur un lieu de surveillance.
41 * @see Sample
42 */
43 public interface SampleDao
44 {
45 /**
46 * This constant is used as a transformation flag; entities can be converted automatically into value objects
47 * or other types, different methods in a class implementing this interface support this feature: look for
48 * an <code>int</code> parameter called <code>transform</code>.
49 * <p>
50 * This specific flag denotes no transformation will occur.
51 */
52 public static final int TRANSFORM_NONE = 0;
53
54
55 /**
56 * Transforms the given results to a collection of {@link Sample}
57 * instances (this is useful when the returned results contains a row of data and you want just entities only).
58 *
59 * @param results the query results.
60 */
61 public void toEntities(final Collection<?> results);
62
63 /**
64 * Gets an instance of Sample from the persistent store.
65 * @param sampleId
66 * @return Sample
67 */
68 public Sample get(Integer sampleId);
69
70 /**
71 * <p>
72 * Does the same thing as {@link #get(Integer)} with an
73 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
74 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
75 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
76 * optionally transform the entity (into a value object for example). By default, transformation does
77 * not occur.
78 * </p>
79 *
80 * @param transform flag to determine transformation type.
81 * @param sampleId the identifier of the entity to get.
82 * @return either the entity or the object transformed from the entity.
83 */
84 public Object get(int transform, Integer sampleId);
85
86 /**
87 * Loads an instance of Sample from the persistent store.
88 * @param sampleId
89 * @return Sample
90 */
91 public Sample load(Integer sampleId);
92
93 /**
94 * <p>
95 * Does the same thing as {@link #load(Integer)} with an
96 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
97 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
98 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
99 * optionally transform the entity (into a value object for example). By default, transformation does
100 * not occur.
101 * </p>
102 *
103 * @param transform flag to determine transformation type.
104 * @param sampleId the identifier of the entity to load.
105 * @return either the entity or the object transformed from the entity.
106 */
107 public Object load(int transform, Integer sampleId);
108
109 /**
110 * Loads all entities of type {@link Sample}.
111 *
112 * @return the loaded entities.
113 */
114 public Collection<Sample> loadAll();
115
116 /**
117 * <p>
118 * Does the same thing as {@link #loadAll()} with an
119 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
120 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
121 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
122 * transform the entity (into a value object for example). By default, transformation does
123 * not occur.
124 * </p>
125 *
126 * @param transform the flag indicating what transformation to use.
127 * @return the loaded entities.
128 */
129 public Collection<?> loadAll(final int transform);
130
131 /**
132 * <p>
133 * Does the same thing as {@link #loadAll()} with an
134 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
135 * 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
136 * page retrieved.
137 * </p>
138 *
139 * @param pageNumber the page number to retrieve when paging results.
140 * @param pageSize the size of the page to retrieve when paging results.
141 * @return the loaded entities.
142 */
143 public Collection<?> loadAll(final int pageNumber, final int pageSize);
144
145 /**
146 * <p>
147 * Does the same thing as {@link #loadAll(int)} with an
148 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
149 * 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
150 * page retrieved.
151 * </p>
152 *
153 * @param transform the flag indicating what transformation to use.
154 * @param pageNumber the page number to retrieve when paging results.
155 * @param pageSize the size of the page to retrieve when paging results.
156 * @return the loaded entities.
157 */
158 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
159
160 /**
161 * Creates an instance of Sample and adds it to the persistent store.
162 * @param sample
163 * @return Sample
164 */
165 public Sample create(Sample sample);
166
167 /**
168 * <p>
169 * Does the same thing as {@link #create(Sample)} with an
170 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
171 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
172 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
173 * transform the entity (into a value object for example). By default, transformation does
174 * not occur.
175 * </p>
176 * @param transform
177 * @param sample
178 * @return Object
179 */
180 public Object create(int transform, Sample sample);
181
182 /**
183 * Creates a new instance of Sample and adds
184 * from the passed in <code>entities</code> collection
185 *
186 * @param entities the collection of Sample
187 * instances to create.
188 *
189 * @return the created instances.
190 */
191 public Collection<Sample> create(Collection<Sample> entities);
192
193 /**
194 * <p>
195 * Does the same thing as {@link #create(Sample)} with an
196 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
197 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
198 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
199 * transform the entities (into value objects for example). By default, transformation does
200 * not occur.
201 * </p>
202 * @param transform
203 * @param entities
204 * @return Collection
205 */
206 public Collection<?> create(int transform, Collection<Sample> entities);
207
208 /**
209 * <p>
210 * Creates a new <code>Sample</code>
211 * instance from <strong>all</strong> attributes and adds it to
212 * the persistent store.
213 * </p>
214 * @param sampleLb Mmnémonique de l'échantillon
215 * @param sampleNumberIndiv Nombre d'individus constituant l'échantillon. Ce nombre permet de connaître le nombre d'individus
216 constituant la grille de saisie.
217 * @param sampleSize La taille de l'échantillon peut représenter une surface ou un volume suivant les cas. Il peut aussi
218 s'agir du nombre d'individus entrant dans l'homogénat.
219 * @param sampleCm Commentaire de l'échantillon
220 * @param sampleControlDt Date de contrôle de l'échantillon
221 * @param sampleValidDt Date de validation de l'échantillon
222 * @param sampleQualifDt Date de qualification de l'échantillon
223 * @param sampleQualifCm Commentaire de qualification
224 * @param sampleScope Vrai si l'étape de qualification est globale, faux si des éléments fils ou résultats n'ont pas la
225 même étape
226 * @param sampleHasMeas Vrai si l'élément a des résultats de mesure, dénombrement ou fichier
227 * @param updateDt Date de modification de l'objet, mise à jour par le système
228 * @param remoteId
229 * @return Sample
230 */
231 public Sample create(
232 String sampleLb,
233 Integer sampleNumberIndiv,
234 Float sampleSize,
235 String sampleCm,
236 Date sampleControlDt,
237 Date sampleValidDt,
238 Date sampleQualifDt,
239 String sampleQualifCm,
240 String sampleScope,
241 String sampleHasMeas,
242 Timestamp updateDt,
243 Integer remoteId);
244
245 /**
246 * <p>
247 * Does the same thing as {@link #create(String, Integer, Float, String, Date, Date, Date, String, String, String, Timestamp, Integer)} with an
248 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
249 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
250 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
251 * transform the entity (into a value object for example). By default, transformation does
252 * not occur.
253 * </p>
254 * @param transform
255 * @param sampleLb Mmnémonique de l'échantillon
256 * @param sampleNumberIndiv Nombre d'individus constituant l'échantillon. Ce nombre permet de connaître le nombre d'individus
257 constituant la grille de saisie.
258 * @param sampleSize La taille de l'échantillon peut représenter une surface ou un volume suivant les cas. Il peut aussi
259 s'agir du nombre d'individus entrant dans l'homogénat.
260 * @param sampleCm Commentaire de l'échantillon
261 * @param sampleControlDt Date de contrôle de l'échantillon
262 * @param sampleValidDt Date de validation de l'échantillon
263 * @param sampleQualifDt Date de qualification de l'échantillon
264 * @param sampleQualifCm Commentaire de qualification
265 * @param sampleScope Vrai si l'étape de qualification est globale, faux si des éléments fils ou résultats n'ont pas la
266 même étape
267 * @param sampleHasMeas Vrai si l'élément a des résultats de mesure, dénombrement ou fichier
268 * @param updateDt Date de modification de l'objet, mise à jour par le système
269 * @param remoteId
270 * @return Sample
271 */
272 public Object create(
273 int transform,
274 String sampleLb,
275 Integer sampleNumberIndiv,
276 Float sampleSize,
277 String sampleCm,
278 Date sampleControlDt,
279 Date sampleValidDt,
280 Date sampleQualifDt,
281 String sampleQualifCm,
282 String sampleScope,
283 String sampleHasMeas,
284 Timestamp updateDt,
285 Integer remoteId);
286
287 /**
288 * <p>
289 * Creates a new <code>Sample</code>
290 * instance from only <strong>required</strong> properties (attributes
291 * and association ends) and adds it to the persistent store.
292 * </p>
293 * @param recorderDepartment
294 * @param matrix
295 * @param qualityFlag
296 * @param samplingOperation
297 * @return Sample
298 */
299 public Sample create(
300 Department recorderDepartment,
301 Matrix matrix,
302 QualityFlag qualityFlag,
303 SamplingOperation samplingOperation);
304
305 /**
306 * <p>
307 * Does the same thing as {@link #create()} with an
308 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
309 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
310 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
311 * transform the entity (into a value object for example). By default, transformation does
312 * not occur.
313 * </p>
314 * @param transform flag to determine transformation type.
315 * @param recorderDepartment
316 * @param matrix
317 * @param qualityFlag
318 * @param samplingOperation
319 * @return Object
320 */
321 public Object create(
322 int transform,
323 Department recorderDepartment,
324 Matrix matrix,
325 QualityFlag qualityFlag,
326 SamplingOperation samplingOperation);
327
328 /**
329 * Updates the <code>sample</code> instance in the persistent store.
330 * @param sample
331 */
332 public void update(Sample sample);
333
334 /**
335 * Updates all instances in the <code>entities</code> collection in the persistent store.
336 * @param entities
337 */
338 public void update(Collection<Sample> entities);
339
340 /**
341 * Removes the instance of Sample from the persistent store.
342 * @param sample
343 */
344 public void remove(Sample sample);
345
346 /**
347 * Removes the instance of Sample having the given
348 * <code>identifier</code> from the persistent store.
349 * @param sampleId
350 */
351 public void remove(Integer sampleId);
352
353 /**
354 * Removes all entities in the given <code>entities</code> collection.
355 * @param entities
356 */
357 public void remove(Collection<Sample> entities);
358
359
360 /**
361 * Does the same thing as {@link #search(int, Search)} but with an
362 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
363 * limit your data to a specified page number and size.
364 *
365 * @param transform the transformation flag.
366 * @param pageNumber the page number in the data to retrieve
367 * @param pageSize the size of the page to retrieve.
368 * @param search the search object which provides the search parameters and pagination specification.
369 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
370 */
371 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
372
373 /**
374 * Does the same thing as {@link #search(Search)} but with an
375 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
376 * limit your data to a specified page number and size.
377 *
378 * @param pageNumber the page number in the data to retrieve
379 * @param pageSize the size of the page to retrieve.
380 * @param search the search object which provides the search parameters and pagination specification.
381 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
382 */
383 public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
384
385 /**
386 * Does the same thing as {@link #search(Search)} but with an
387 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
388 * finder results will <strong>NOT</strong> be transformed during retrieval.
389 * If this flag is any of the other constants defined here
390 * then results <strong>WILL BE</strong> passed through an operation which can optionally
391 * transform the entities (into value objects for example). By default, transformation does
392 * not occur.
393 *
394 * @param transform the transformation flag.
395 * @param search the search object which provides the search parameters and pagination specification.
396 * @return any found results from the search.
397 */
398 public Set<?> search(final int transform, final Search search);
399
400 /**
401 * Performs a search using the parameters specified in the given <code>search</code> object.
402 *
403 * @param search the search object which provides the search parameters and pagination specification.
404 * @return any found results from the search.
405 */
406 public Set<Sample> search(final Search search);
407
408 /**
409 * Allows transformation of entities into value objects
410 * (or something else for that matter), when the <code>transform</code>
411 * flag is set to one of the constants defined in <code>fr.ifremer.quadrige3.core.dao.data.sample.SampleDao</code>, please note
412 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
413 * will be returned.
414 *
415 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
416 *
417 * @param transform one of the constants declared in {@link fr.ifremer.quadrige3.core.dao.data.sample.SampleDao}
418 * @param entity an entity that was found
419 * @return the transformed entity (i.e. new value object, etc)
420 * @see #transformEntities(int,Collection)
421 */
422 public Object transformEntity(final int transform, final Sample entity);
423
424 /**
425 * Transforms a collection of entities using the
426 * {@link #transformEntity(int,Sample)}
427 * method. This method does not instantiate a new collection.
428 * <p>
429 * This method is to be used internally only.
430 *
431 * @param transform one of the constants declared in <code>fr.ifremer.quadrige3.core.dao.data.sample.SampleDao</code>
432 * @param entities the collection of entities to transform
433 * @see #transformEntity(int,Sample)
434 */
435 public void transformEntities(final int transform, final Collection<?> entities);
436
437 // spring-dao merge-point
438 }