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