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.survey;
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.vo.data.survey.OccasionVO;
31 import java.sql.Timestamp;
32 import java.util.Collection;
33 import java.util.Date;
34 import java.util.Set;
35 import org.andromda.spring.PaginationResult;
36
37 /**
38 * Liste des sorties effectuées lors d'une campagne.
39 * @see Occasion
40 */
41 public interface OccasionDao
42 {
43 /**
44 * This constant is used as a transformation flag; entities can be converted automatically into value objects
45 * or other types, different methods in a class implementing this interface support this feature: look for
46 * an <code>int</code> parameter called <code>transform</code>.
47 * <p>
48 * This specific flag denotes no transformation will occur.
49 */
50 public static final int TRANSFORM_NONE = 0;
51
52
53 /**
54 * Transforms the given results to a collection of {@link Occasion}
55 * instances (this is useful when the returned results contains a row of data and you want just entities only).
56 *
57 * @param results the query results.
58 */
59 public void toEntities(final Collection<?> results);
60
61 /**
62 * This constant is used as a transformation flag; entities can be converted automatically into value objects
63 * or other types, different methods in a class implementing this interface support this feature: look for
64 * an <code>int</code> parameter called <code>transform</code>.
65 * <p>
66 * This specific flag denotes entities must be transformed into objects of type
67 * {@link OccasionVO}.
68 */
69 public static final int TRANSFORM_OCCASIONVO = 1;
70
71 /**
72 * Copies the fields of the specified entity to the target value object. This method is similar to
73 * toOccasionVO(), but it does not handle any attributes in the target
74 * value object that are "read-only" (as those do not have setter methods exposed).
75 * @param source
76 * @param target
77 */
78 public void toOccasionVO(
79 Occasion source,
80 OccasionVO target);
81
82 /**
83 * Converts this DAO's entity to an object of type {@link OccasionVO}.
84 * @param entity
85 * @return OccasionVO
86 */
87 public OccasionVO toOccasionVO(Occasion entity);
88
89 /**
90 * Converts this DAO's entity to a Collection of instances of type {@link OccasionVO}.
91 * @param entities
92 */
93 public Collection<OccasionVO> toOccasionVOCollection(Collection<?> entities);
94
95 /**
96 * Converts this DAO's entity to an array of instances of type {@link OccasionVO}.
97 * @param entities
98 * @return OccasionVO[]
99 */
100 public OccasionVO[] toOccasionVOArray(Collection<?> entities);
101
102 /**
103 * Copies the fields of {@link OccasionVO} to the specified entity.
104 * @param source
105 * @param target
106 * @param copyIfNull If FALSE, the value object's field will not be copied to the entity if the value is NULL. If TRUE,
107 * it will be copied regardless of its value.
108 */
109 public void occasionVOToEntity(
110 OccasionVO source,
111 Occasion target,
112 boolean copyIfNull);
113
114 /**
115 * Converts an instance of type {@link OccasionVO} to this DAO's entity.
116 * @param occasionVO
117 * @return Occasion
118 */
119 public Occasion occasionVOToEntity(OccasionVO occasionVO);
120
121 /**
122 * Converts a Collection of instances of type {@link OccasionVO} to this
123 * DAO's entity.
124 * @param instances
125 */
126 public void occasionVOToEntityCollection(Collection<?> instances);
127
128 /**
129 * Gets an instance of Occasion from the persistent store.
130 * @param occasId
131 * @return Occasion
132 */
133 public Occasion get(Integer occasId);
134
135 /**
136 * <p>
137 * Does the same thing as {@link #get(Integer)} with an
138 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
139 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
140 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
141 * optionally transform the entity (into a value object for example). By default, transformation does
142 * not occur.
143 * </p>
144 *
145 * @param transform flag to determine transformation type.
146 * @param occasId the identifier of the entity to get.
147 * @return either the entity or the object transformed from the entity.
148 */
149 public Object get(int transform, Integer occasId);
150
151 /**
152 * Loads an instance of Occasion from the persistent store.
153 * @param occasId
154 * @return Occasion
155 */
156 public Occasion load(Integer occasId);
157
158 /**
159 * <p>
160 * Does the same thing as {@link #load(Integer)} with an
161 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
162 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
163 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
164 * optionally transform the entity (into a value object for example). By default, transformation does
165 * not occur.
166 * </p>
167 *
168 * @param transform flag to determine transformation type.
169 * @param occasId the identifier of the entity to load.
170 * @return either the entity or the object transformed from the entity.
171 */
172 public Object load(int transform, Integer occasId);
173
174 /**
175 * Loads all entities of type {@link Occasion}.
176 *
177 * @return the loaded entities.
178 */
179 public Collection<Occasion> loadAll();
180
181 /**
182 * <p>
183 * Does the same thing as {@link #loadAll()} with an
184 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
185 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
186 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
187 * transform the entity (into a value object for example). By default, transformation does
188 * not occur.
189 * </p>
190 *
191 * @param transform the flag indicating what transformation to use.
192 * @return the loaded entities.
193 */
194 public Collection<?> loadAll(final int transform);
195
196 /**
197 * <p>
198 * Does the same thing as {@link #loadAll()} with an
199 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
200 * 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
201 * page retrieved.
202 * </p>
203 *
204 * @param pageNumber the page number to retrieve when paging results.
205 * @param pageSize the size of the page to retrieve when paging results.
206 * @return the loaded entities.
207 */
208 public Collection<?> loadAll(final int pageNumber, final int pageSize);
209
210 /**
211 * <p>
212 * Does the same thing as {@link #loadAll(int)} with an
213 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
214 * 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
215 * page retrieved.
216 * </p>
217 *
218 * @param transform the flag indicating what transformation to use.
219 * @param pageNumber the page number to retrieve when paging results.
220 * @param pageSize the size of the page to retrieve when paging results.
221 * @return the loaded entities.
222 */
223 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
224
225 /**
226 * Creates an instance of Occasion and adds it to the persistent store.
227 * @param occasion
228 * @return Occasion
229 */
230 public Occasion create(Occasion occasion);
231
232 /**
233 * <p>
234 * Does the same thing as {@link #create(Occasion)} with an
235 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
236 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
237 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
238 * transform the entity (into a value object for example). By default, transformation does
239 * not occur.
240 * </p>
241 * @param transform
242 * @param occasion
243 * @return Object
244 */
245 public Object create(int transform, Occasion occasion);
246
247 /**
248 * Creates a new instance of Occasion and adds
249 * from the passed in <code>entities</code> collection
250 *
251 * @param entities the collection of Occasion
252 * instances to create.
253 *
254 * @return the created instances.
255 */
256 public Collection<Occasion> create(Collection<Occasion> entities);
257
258 /**
259 * <p>
260 * Does the same thing as {@link #create(Occasion)} with an
261 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
262 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
263 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
264 * transform the entities (into value objects for example). By default, transformation does
265 * not occur.
266 * </p>
267 * @param transform
268 * @param entities
269 * @return Collection
270 */
271 public Collection<?> create(int transform, Collection<Occasion> entities);
272
273 /**
274 * <p>
275 * Creates a new <code>Occasion</code>
276 * instance from <strong>all</strong> attributes and adds it to
277 * the persistent store.
278 * </p>
279 * @param occasDt Date et heure de la sortie.
280 L'heure n'est pas obligatoire, par défaut 00:00:00
281 * @param occasNm Llibellé décrivant la sortie
282 * @param occasCm Commentaire sur la sortie
283 * @param occasPositionCm Commentaire décrivant la localisation de la sortie
284 * @param updateDt Date de modification de l'objet, mise à jour par le système
285 * @param remoteId
286 * @return Occasion
287 */
288 public Occasion create(
289 Date occasDt,
290 String occasNm,
291 String occasCm,
292 String occasPositionCm,
293 Timestamp updateDt,
294 Integer remoteId);
295
296 /**
297 * <p>
298 * Does the same thing as {@link #create(Date, String, String, String, Timestamp, Integer)} with an
299 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
300 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
301 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
302 * transform the entity (into a value object for example). By default, transformation does
303 * not occur.
304 * </p>
305 * @param transform
306 * @param occasDt Date et heure de la sortie.
307 L'heure n'est pas obligatoire, par défaut 00:00:00
308 * @param occasNm Llibellé décrivant la sortie
309 * @param occasCm Commentaire sur la sortie
310 * @param occasPositionCm Commentaire décrivant la localisation de la sortie
311 * @param updateDt Date de modification de l'objet, mise à jour par le système
312 * @param remoteId
313 * @return Occasion
314 */
315 public Object create(
316 int transform,
317 Date occasDt,
318 String occasNm,
319 String occasCm,
320 String occasPositionCm,
321 Timestamp updateDt,
322 Integer remoteId);
323
324 /**
325 * <p>
326 * Creates a new <code>Occasion</code>
327 * instance from only <strong>required</strong> properties (attributes
328 * and association ends) and adds it to the persistent store.
329 * </p>
330 * @param occasDt
331 * @param occasNm
332 * @param campaign
333 * @param recorderDepartment
334 * @return Occasion
335 */
336 public Occasion create(
337 Date occasDt,
338 String occasNm,
339 Campaign campaign,
340 Department recorderDepartment);
341
342 /**
343 * <p>
344 * Does the same thing as {@link #create(Date, String)} with an
345 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
346 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
347 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
348 * transform the entity (into a value object for example). By default, transformation does
349 * not occur.
350 * </p>
351 * @param transform flag to determine transformation type.
352 * @param occasDt
353 * @param occasNm
354 * @param campaign
355 * @param recorderDepartment
356 * @return Object
357 */
358 public Object create(
359 int transform,
360 Date occasDt,
361 String occasNm,
362 Campaign campaign,
363 Department recorderDepartment);
364
365 /**
366 * Updates the <code>occasion</code> instance in the persistent store.
367 * @param occasion
368 */
369 public void update(Occasion occasion);
370
371 /**
372 * Updates all instances in the <code>entities</code> collection in the persistent store.
373 * @param entities
374 */
375 public void update(Collection<Occasion> entities);
376
377 /**
378 * Removes the instance of Occasion from the persistent store.
379 * @param occasion
380 */
381 public void remove(Occasion occasion);
382
383 /**
384 * Removes the instance of Occasion having the given
385 * <code>identifier</code> from the persistent store.
386 * @param occasId
387 */
388 public void remove(Integer occasId);
389
390 /**
391 * Removes all entities in the given <code>entities</code> collection.
392 * @param entities
393 */
394 public void remove(Collection<Occasion> entities);
395
396 /**
397 *
398 * @param occasion
399 * @param updateDt
400 * @return OccasionVO
401 */
402 public OccasionVO save(OccasionVO occasion, Timestamp updateDt);
403
404 /**
405 *
406 * @param occasIds
407 * @return void
408 */
409 public void removeByIds(Collection<Integer> occasIds);
410
411
412 /**
413 * Does the same thing as {@link #search(int, Search)} but with an
414 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
415 * limit your data to a specified page number and size.
416 *
417 * @param transform the transformation flag.
418 * @param pageNumber the page number in the data to retrieve
419 * @param pageSize the size of the page to retrieve.
420 * @param search the search object which provides the search parameters and pagination specification.
421 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
422 */
423 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
424
425 /**
426 * Does the same thing as {@link #search(Search)} but with an
427 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
428 * limit your data to a specified page number and size.
429 *
430 * @param pageNumber the page number in the data to retrieve
431 * @param pageSize the size of the page to retrieve.
432 * @param search the search object which provides the search parameters and pagination specification.
433 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
434 */
435 public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
436
437 /**
438 * Does the same thing as {@link #search(Search)} but with an
439 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
440 * finder results will <strong>NOT</strong> be transformed during retrieval.
441 * If this flag is any of the other constants defined here
442 * then results <strong>WILL BE</strong> passed through an operation which can optionally
443 * transform the entities (into value objects for example). By default, transformation does
444 * not occur.
445 *
446 * @param transform the transformation flag.
447 * @param search the search object which provides the search parameters and pagination specification.
448 * @return any found results from the search.
449 */
450 public Set<?> search(final int transform, final Search search);
451
452 /**
453 * Performs a search using the parameters specified in the given <code>search</code> object.
454 *
455 * @param search the search object which provides the search parameters and pagination specification.
456 * @return any found results from the search.
457 */
458 public Set<Occasion> search(final Search search);
459
460 /**
461 * Allows transformation of entities into value objects
462 * (or something else for that matter), when the <code>transform</code>
463 * flag is set to one of the constants defined in <code>fr.ifremer.quadrige3.core.dao.data.survey.OccasionDao</code>, please note
464 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
465 * will be returned.
466 * <p>
467 * This method will return instances of these types:
468 * <ul>
469 * <li>{@link Occasion} - {@link #TRANSFORM_NONE}</li>
470 * <li>{@link OccasionVO} - {@link #TRANSFORM_OCCASIONVO}</li>
471 * </ul>
472 *
473 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
474 *
475 * @param transform one of the constants declared in {@link fr.ifremer.quadrige3.core.dao.data.survey.OccasionDao}
476 * @param entity an entity that was found
477 * @return the transformed entity (i.e. new value object, etc)
478 * @see #transformEntities(int,Collection)
479 */
480 public Object transformEntity(final int transform, final Occasion entity);
481
482 /**
483 * Transforms a collection of entities using the
484 * {@link #transformEntity(int,Occasion)}
485 * method. This method does not instantiate a new collection.
486 * <p>
487 * This method is to be used internally only.
488 *
489 * @param transform one of the constants declared in <code>fr.ifremer.quadrige3.core.dao.data.survey.OccasionDao</code>
490 * @param entities the collection of entities to transform
491 * @see #transformEntity(int,Occasion)
492 */
493 public void transformEntities(final int transform, final Collection<?> entities);
494
495 // spring-dao merge-point
496 }