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