001// license-header java merge-point
002//
003// Attention: Generated code! Do not modify by hand!
004// Generated by: SpringDao.vsl in andromda-spring-cartridge.
005//
006package fr.ifremer.adagio.core.dao.referential.grouping;
007
008/*
009 * #%L
010 * SIH-Adagio :: Core
011 * $Id:$
012 * $HeadURL:$
013 * %%
014 * Copyright (C) 2012 - 2014 Ifremer
015 * %%
016 * This program is free software: you can redistribute it and/or modify
017 * it under the terms of the GNU Affero General Public License as published by
018 * the Free Software Foundation, either version 3 of the License, or
019 * (at your option) any later version.
020 * 
021 * This program is distributed in the hope that it will be useful,
022 * but WITHOUT ANY WARRANTY; without even the implied warranty of
023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
024 * GNU General Public License for more details.
025 * 
026 * You should have received a copy of the GNU Affero General Public License
027 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
028 * #L%
029 */
030
031import fr.ifremer.adagio.core.dao.Search;
032import fr.ifremer.adagio.core.dao.referential.Status;
033import fr.ifremer.adagio.core.dao.referential.ValidityStatus;
034import java.sql.Timestamp;
035import java.util.Collection;
036import java.util.Set;
037import org.andromda.spring.PaginationResult;
038
039/**
040 * <html>
041 * <head>
042 * <style>
043 * p {padding:0px; margin:0px;}
044 * </style>
045 * </head>
046 * <body>
047 * <p>
048 * Un regroupement représente un groupement d'entités (du référentiel ou
049 * bien de navires), correspondant à un niveau de regroupement donné (<i>GroupingLevel</i>).
050 * </p>
051 * <p>
052 * </p>
053 * <p>
054 * Un regroupement peut faire référence à une ou plusieurs entités du
055 * référentiel (<i>GroupingItem</i>). Généralement, surtout les
056 * regroupements de plus bas niveau sont liés à des entités du référentiel
057 * (plus facile à maintenir), puis une table technique remplie toutes les
058 * associations possible avec les ancêtres (cf <i>GroupingItemHierarchy</i>).
059 * </p>
060 * <p>
061 * </p>
062 * <p>
063 * Un regroupement peut avoir un regroupement parent.
064 * </p>
065 * </body>
066 * </html>
067 * @see Grouping
068 */
069public interface GroupingDao
070{
071    /**
072     * This constant is used as a transformation flag; entities can be converted automatically into value objects
073     * or other types, different methods in a class implementing this interface support this feature: look for
074     * an <code>int</code> parameter called <code>transform</code>.
075     * <p>
076     * This specific flag denotes no transformation will occur.
077     */
078    public static final int TRANSFORM_NONE = 0;
079
080
081    /**
082     * Transforms the given results to a collection of {@link Grouping}
083     * instances (this is useful when the returned results contains a row of data and you want just entities only).
084     *
085     * @param results the query results.
086     */
087    public void toEntities(final Collection<?> results);
088
089    /**
090     * Gets an instance of Grouping from the persistent store.
091     * @param id
092     * @return Grouping
093     */
094    public Grouping get(Integer id);
095
096    /**
097     * <p>
098     * Does the same thing as {@link #get(Integer)} with an
099     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
100     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
101     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
102     * optionally transform the entity (into a value object for example). By default, transformation does
103     * not occur.
104     * </p>
105     *
106     * @param transform flag to determine transformation type.
107     * @param id the identifier of the entity to get.
108     * @return either the entity or the object transformed from the entity.
109     */
110    public Object get(int transform, Integer id);
111
112    /**
113     * Loads an instance of Grouping from the persistent store.
114     * @param id
115     * @return Grouping
116     */
117    public Grouping load(Integer id);
118
119    /**
120     * <p>
121     * Does the same thing as {@link #load(Integer)} with an
122     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
123     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
124     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
125     * optionally transform the entity (into a value object for example). By default, transformation does
126     * not occur.
127     * </p>
128     *
129     * @param transform flag to determine transformation type.
130     * @param id the identifier of the entity to load.
131     * @return either the entity or the object transformed from the entity.
132     */
133    public Object load(int transform, Integer id);
134
135    /**
136     * Loads all entities of type {@link Grouping}.
137     *
138     * @return the loaded entities.
139     */
140    public Collection<Grouping> loadAll();
141
142    /**
143     * <p>
144     * Does the same thing as {@link #loadAll()} with an
145     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
146     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
147     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
148     * transform the entity (into a value object for example). By default, transformation does
149     * not occur.
150     * </p>
151     *
152     * @param transform the flag indicating what transformation to use.
153     * @return the loaded entities.
154     */
155    public Collection<?> loadAll(final int transform);
156
157    /**
158     * <p>
159     * Does the same thing as {@link #loadAll()} with an
160     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
161     * 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
162     * page retrieved.
163     * </p>
164     *
165     * @param pageNumber the page number to retrieve when paging results.
166     * @param pageSize the size of the page to retrieve when paging results.
167     * @return the loaded entities.
168     */
169    public Collection<?> loadAll(final int pageNumber, final int pageSize);
170
171    /**
172     * <p>
173     * Does the same thing as {@link #loadAll(int)} with an
174     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
175     * 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
176     * page retrieved.
177     * </p>
178     *
179     * @param transform the flag indicating what transformation to use.
180     * @param pageNumber the page number to retrieve when paging results.
181     * @param pageSize the size of the page to retrieve when paging results.
182     * @return the loaded entities.
183     */
184    public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
185
186    /**
187     * Creates an instance of Grouping and adds it to the persistent store.
188     * @param grouping
189     * @return Grouping
190     */
191    public Grouping create(Grouping grouping);
192
193    /**
194     * <p>
195     * Does the same thing as {@link #create(Grouping)} with an
196     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
197     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
198     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
199     * transform the entity (into a value object for example). By default, transformation does
200     * not occur.
201     * </p>
202     * @param transform
203     * @param grouping
204     * @return Object
205     */
206    public Object create(int transform, Grouping grouping);
207
208    /**
209     * Creates a new instance of Grouping and adds
210     * from the passed in <code>entities</code> collection
211     *
212     * @param entities the collection of Grouping
213     * instances to create.
214     *
215     * @return the created instances.
216     */
217    public Collection<Grouping> create(Collection<Grouping> entities);
218
219    /**
220     * <p>
221     * Does the same thing as {@link #create(Grouping)} with an
222     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
223     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
224     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
225     * transform the entities (into value objects for example). By default, transformation does
226     * not occur.
227     * </p>
228     * @param transform
229     * @param entities
230     * @return Collection
231     */
232    public Collection<?> create(int transform, Collection<Grouping> entities);
233
234    /**
235     * <p>
236     * Creates a new <code>Grouping</code>
237     * instance from <strong>all</strong> attributes and adds it to
238     * the persistent store.
239     * </p>
240     * @param label <html>
241<head>
242<style>
243p {padding:0px; margin:0px;}
244</style>
245</head>
246<body>
247<p>
248Code mnémotechnique représentant le regroupement.
249</p>
250<p>
251</p>
252<p>
253Par exemple :
254</p>
255<p>
256- pour une classe taille de navire : &quot;[0-10[m&quot;, &quot;[10-20[m&quot;, etc.
257</p>
258<p>
259- pour un regroupement de métiers, le code du regroupement, etc.
260</p>
261</body>
262</html>
263     * @param name 
264     * @param minValue <html>
265<head>
266<style>
267p {padding:0px; margin:0px;}
268</style>
269</head>
270<body>
271<p>
272Valeur minimum de la caractéristique de regroupement.
273</p>
274<p>
275</p>
276<p>
277Uniquement dans le cas où une caractéristique a été définie sur le
278niveau de regroupement parent (uniquement si <i>GroupLevel.featuresPmfm </i>est
279renseigné).
280</p>
281<p>
282</p>
283<p>
284Exemple : Si la caractéristique est &quot;Longueur du navire&quot;, la valeur min
285vaudra &quot;10&quot;, pour une classe de taille de 10 à 20 m.
286</p>
287</body>
288</html>
289     * @param maxValue <html>
290<head>
291<style>
292p {padding:0px; margin:0px;}
293</style>
294</head>
295<body>
296<p>
297Valeur maximale de la caractéristique de regroupement.
298</p>
299<p>
300</p>
301<p>
302Uniquement dans le cas où une caractéristique a été définie sur le
303niveau de regroupement parent (uniquement si <i>GroupLevel.featuresPmfm </i>est
304renseigné).
305</p>
306<p>
307</p>
308<p>
309Par convention, la valeur maximale du regroupement est EXCLUE.
310</p>
311<p>
312</p>
313<p>
314Exemple : Si la caractéristique est &quot;Longueur du navire&quot;, la valeur max
315vaudra &quot;20&quot;, pour une classe de taille de [10-20[m (20 étant exclu).
316</p>
317</body>
318</html>
319     * @param updateDate 
320     * @param comments 
321     * @return Grouping
322     */
323    public Grouping create(
324        String label,
325        String name,
326        Double minValue,
327        Double maxValue,
328        Timestamp updateDate,
329        String comments);
330
331    /**
332     * <p>
333     * Does the same thing as {@link #create(String, String, Double, Double, Timestamp, String)} with an
334     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
335     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
336     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
337     * transform the entity (into a value object for example). By default, transformation does
338     * not occur.
339     * </p>
340     * @param transform
341     * @param label <html>
342<head>
343<style>
344p {padding:0px; margin:0px;}
345</style>
346</head>
347<body>
348<p>
349Code mnémotechnique représentant le regroupement.
350</p>
351<p>
352</p>
353<p>
354Par exemple :
355</p>
356<p>
357- pour une classe taille de navire : &quot;[0-10[m&quot;, &quot;[10-20[m&quot;, etc.
358</p>
359<p>
360- pour un regroupement de métiers, le code du regroupement, etc.
361</p>
362</body>
363</html>
364     * @param name 
365     * @param minValue <html>
366<head>
367<style>
368p {padding:0px; margin:0px;}
369</style>
370</head>
371<body>
372<p>
373Valeur minimum de la caractéristique de regroupement.
374</p>
375<p>
376</p>
377<p>
378Uniquement dans le cas où une caractéristique a été définie sur le
379niveau de regroupement parent (uniquement si <i>GroupLevel.featuresPmfm </i>est
380renseigné).
381</p>
382<p>
383</p>
384<p>
385Exemple : Si la caractéristique est &quot;Longueur du navire&quot;, la valeur min
386vaudra &quot;10&quot;, pour une classe de taille de 10 à 20 m.
387</p>
388</body>
389</html>
390     * @param maxValue <html>
391<head>
392<style>
393p {padding:0px; margin:0px;}
394</style>
395</head>
396<body>
397<p>
398Valeur maximale de la caractéristique de regroupement.
399</p>
400<p>
401</p>
402<p>
403Uniquement dans le cas où une caractéristique a été définie sur le
404niveau de regroupement parent (uniquement si <i>GroupLevel.featuresPmfm </i>est
405renseigné).
406</p>
407<p>
408</p>
409<p>
410Par convention, la valeur maximale du regroupement est EXCLUE.
411</p>
412<p>
413</p>
414<p>
415Exemple : Si la caractéristique est &quot;Longueur du navire&quot;, la valeur max
416vaudra &quot;20&quot;, pour une classe de taille de [10-20[m (20 étant exclu).
417</p>
418</body>
419</html>
420     * @param updateDate 
421     * @param comments 
422     * @return Grouping
423     */
424    public Object create(
425        int transform,
426        String label,
427        String name,
428        Double minValue,
429        Double maxValue,
430        Timestamp updateDate,
431        String comments);
432
433    /**
434     * <p>
435     * Creates a new <code>Grouping</code>
436     * instance from only <strong>required</strong> properties (attributes
437     * and association ends) and adds it to the persistent store.
438     * </p>
439     * @param groupingClassification
440     * @param groupingLevel
441     * @param label
442     * @param name
443     * @param status
444     * @param updateDate
445     * @param validityStatus
446     * @return Grouping
447     */
448    public Grouping create(
449        GroupingClassification groupingClassification,
450        GroupingLevel groupingLevel,
451        String label,
452        String name,
453        Status status,
454        Timestamp updateDate,
455        ValidityStatus validityStatus);
456
457    /**
458     * <p>
459     * Does the same thing as {@link #create(String, String, Timestamp)} with an
460     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
461     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
462     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
463     * transform the entity (into a value object for example). By default, transformation does
464     * not occur.
465     * </p>
466     * @param transform flag to determine transformation type.
467     * @param groupingClassification
468     * @param groupingLevel
469     * @param label
470     * @param name
471     * @param status
472     * @param updateDate
473     * @param validityStatus
474     * @return Object
475     */
476    public Object create(
477        int transform,
478        GroupingClassification groupingClassification,
479        GroupingLevel groupingLevel,
480        String label,
481        String name,
482        Status status,
483        Timestamp updateDate,
484        ValidityStatus validityStatus);
485
486    /**
487     * Updates the <code>grouping</code> instance in the persistent store.
488     * @param grouping
489     */
490    public void update(Grouping grouping);
491
492    /**
493     * Updates all instances in the <code>entities</code> collection in the persistent store.
494     * @param entities
495     */
496    public void update(Collection<Grouping> entities);
497
498    /**
499     * Removes the instance of Grouping from the persistent store.
500     * @param grouping
501     */
502    public void remove(Grouping grouping);
503
504    /**
505     * Removes the instance of Grouping having the given
506     * <code>identifier</code> from the persistent store.
507     * @param id
508     */
509    public void remove(Integer id);
510
511    /**
512     * Removes all entities in the given <code>entities</code> collection.
513     * @param entities
514     */
515    public void remove(Collection<Grouping> entities);
516
517
518    /**
519     * Does the same thing as {@link #search(int, Search)} but with an
520     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
521     * limit your data to a specified page number and size.
522     *
523     * @param transform the transformation flag.
524     * @param pageNumber the page number in the data to retrieve
525     * @param pageSize the size of the page to retrieve.
526     * @param search the search object which provides the search parameters and pagination specification.
527     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
528     */
529    public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
530
531    /**
532     * Does the same thing as {@link #search(Search)} but with an
533     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
534     * limit your data to a specified page number and size.
535     *
536     * @param pageNumber the page number in the data to retrieve
537     * @param pageSize the size of the page to retrieve.
538     * @param search the search object which provides the search parameters and pagination specification.
539     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
540     */
541    public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
542
543    /**
544     * Does the same thing as {@link #search(Search)} but with an
545     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
546     * finder results will <strong>NOT</strong> be transformed during retrieval.
547     * If this flag is any of the other constants defined here
548     * then results <strong>WILL BE</strong> passed through an operation which can optionally
549     * transform the entities (into value objects for example). By default, transformation does
550     * not occur.
551     *
552     * @param transform the transformation flag.
553     * @param search the search object which provides the search parameters and pagination specification.
554     * @return any found results from the search.
555     */
556    public Set<?> search(final int transform, final Search search);
557
558    /**
559     * Performs a search using the parameters specified in the given <code>search</code> object.
560     *
561     * @param search the search object which provides the search parameters and pagination specification.
562     * @return any found results from the search.
563     */
564    public Set<Grouping> search(final Search search);
565
566    /**
567     * Allows transformation of entities into value objects
568     * (or something else for that matter), when the <code>transform</code>
569     * flag is set to one of the constants defined in <code>fr.ifremer.adagio.core.dao.referential.grouping.GroupingDao</code>, please note
570     * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
571     * will be returned.
572     *
573     * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
574     *
575     * @param transform one of the constants declared in {@link fr.ifremer.adagio.core.dao.referential.grouping.GroupingDao}
576     * @param entity an entity that was found
577     * @return the transformed entity (i.e. new value object, etc)
578     * @see #transformEntities(int,Collection)
579     */
580    public Object transformEntity(final int transform, final Grouping entity);
581
582    /**
583     * Transforms a collection of entities using the
584     * {@link #transformEntity(int,Grouping)}
585     * method. This method does not instantiate a new collection.
586     * <p>
587     * This method is to be used internally only.
588     *
589     * @param transform one of the constants declared in <code>fr.ifremer.adagio.core.dao.referential.grouping.GroupingDao</code>
590     * @param entities the collection of entities to transform
591     * @see #transformEntity(int,Grouping)
592     */
593    public void transformEntities(final int transform, final Collection<?> entities);
594
595    // spring-dao merge-point
596}