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