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