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