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