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