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.metier;
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 * </head>
043 * <body>
044 * <p>
045 * M&#233;tier, qui peut etre un m&#233;tier de peche ou non.<br><br>Un
046 * m&#233;tier de peche a obligatoirement une esp&#232;ce cible (TaxonGroup) de
047 * d&#233;fini, et &#233;ventuellement un engin (Gear).
048 * </p>
049 * <p>
050 * Dans ce cas, le nom (name) et le mn&#233;monique (label) pourront etre
051 * d&#233;termin&#233; par la concat&#233;nation de l'engin et de l'esp&#232;ce cible.
052 * </p>
053 * <p>
054 * <br>
055 * <br>
056 * </p>
057 * <p>
058 * <u>V2.1 </u>: modification de la gestion des m&#233;tiers : suppression des
059 * classes FishingMetierGearType et MetierSpecies : un m&#233;tier est
060 * maintenant d&#233;fini directement par Gear et TaxonGroup.<br><br>=&gt; Le
061 * r&#233;f&#233;rentiel des engin du m&#233;tier (FishingMetierGearType) est maintenent
062 * int&#233;gr&#233; au r&#233;f&#233;rentiel g&#233;n&#233;rique des engins<br>
063 * </p>
064 * <p>
065 * </p>
066 * <p>
067 * =&gt; Le r&#233;f&#233;rentiel des esp&#232;ces m&#233;tier (MetierSpecies) est maintenent
068 * int&#233;gr&#233; au r&#233;f&#233;rentiel g&#233;n&#233;rique des groupes de taxon<br><br>
069 * </p>
070 * <p>
071 * <u>V3 </u>:<br>- Le m&#233;tier de peche n'a pas forc&#233;ment d'engin
072 * (optionnel) Ex : AQUNEP
073 * </p>
074 * <p>
075 * (Aquaculture)<br>- le mn&#233;monique et le libell&#233; ne sont plus calcul&#233;s &#224;
076 * la vol&#233;e par concat&#233;nation, pour permettre l'utilisation de libell&#233; plus
077 * court..
078 * </p>
079 * </body>
080 * </html>
081 * @see Metier
082 */
083public interface MetierDao
084{
085    /**
086     * This constant is used as a transformation flag; entities can be converted automatically into value objects
087     * or other types, different methods in a class implementing this interface support this feature: look for
088     * an <code>int</code> parameter called <code>transform</code>.
089     * <p>
090     * This specific flag denotes no transformation will occur.
091     */
092    public static final int TRANSFORM_NONE = 0;
093
094
095    /**
096     * Transforms the given results to a collection of {@link Metier}
097     * instances (this is useful when the returned results contains a row of data and you want just entities only).
098     *
099     * @param results the query results.
100     */
101    public void toEntities(final Collection<?> results);
102
103    /**
104     * Gets an instance of Metier from the persistent store.
105     * @param id
106     * @return Metier
107     */
108    public Metier get(Integer id);
109
110    /**
111     * <p>
112     * Does the same thing as {@link #get(Integer)} with an
113     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
114     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
115     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
116     * optionally transform the entity (into a value object for example). By default, transformation does
117     * not occur.
118     * </p>
119     *
120     * @param transform flag to determine transformation type.
121     * @param id the identifier of the entity to get.
122     * @return either the entity or the object transformed from the entity.
123     */
124    public Object get(int transform, Integer id);
125
126    /**
127     * Loads an instance of Metier from the persistent store.
128     * @param id
129     * @return Metier
130     */
131    public Metier load(Integer id);
132
133    /**
134     * <p>
135     * Does the same thing as {@link #load(Integer)} 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 id the identifier of the entity to load.
145     * @return either the entity or the object transformed from the entity.
146     */
147    public Object load(int transform, Integer id);
148
149    /**
150     * Loads all entities of type {@link Metier}.
151     *
152     * @return the loaded entities.
153     */
154    public Collection<Metier> loadAll();
155
156    /**
157     * <p>
158     * Does the same thing as {@link #loadAll()} 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 here then the result <strong>WILL BE</strong> passed through an operation which can optionally
162     * transform the entity (into a value object for example). By default, transformation does
163     * not occur.
164     * </p>
165     *
166     * @param transform the flag indicating what transformation to use.
167     * @return the loaded entities.
168     */
169    public Collection<?> loadAll(final int transform);
170
171    /**
172     * <p>
173     * Does the same thing as {@link #loadAll()} 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 pageNumber the page number to retrieve when paging results.
180     * @param pageSize the size of the page to retrieve when paging results.
181     * @return the loaded entities.
182     */
183    public Collection<?> loadAll(final int pageNumber, final int pageSize);
184
185    /**
186     * <p>
187     * Does the same thing as {@link #loadAll(int)} with an
188     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
189     * 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
190     * page retrieved.
191     * </p>
192     *
193     * @param transform the flag indicating what transformation to use.
194     * @param pageNumber the page number to retrieve when paging results.
195     * @param pageSize the size of the page to retrieve when paging results.
196     * @return the loaded entities.
197     */
198    public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
199
200    /**
201     * Creates an instance of Metier and adds it to the persistent store.
202     * @param metier
203     * @return Metier
204     */
205    public Metier create(Metier metier);
206
207    /**
208     * <p>
209     * Does the same thing as {@link #create(Metier)} with an
210     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
211     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
212     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
213     * transform the entity (into a value object for example). By default, transformation does
214     * not occur.
215     * </p>
216     * @param transform
217     * @param metier
218     * @return Object
219     */
220    public Object create(int transform, Metier metier);
221
222    /**
223     * Creates a new instance of Metier and adds
224     * from the passed in <code>entities</code> collection
225     *
226     * @param entities the collection of Metier
227     * instances to create.
228     *
229     * @return the created instances.
230     */
231    public Collection<Metier> create(Collection<Metier> entities);
232
233    /**
234     * <p>
235     * Does the same thing as {@link #create(Metier)} with an
236     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
237     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
238     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
239     * transform the entities (into value objects for example). By default, transformation does
240     * not occur.
241     * </p>
242     * @param transform
243     * @param entities
244     * @return Collection
245     */
246    public Collection<?> create(int transform, Collection<Metier> entities);
247
248    /**
249     * <p>
250     * Creates a new <code>Metier</code>
251     * instance from <strong>all</strong> attributes and adds it to
252     * the persistent store.
253     * </p>
254     * @param label Pour un métier de peche, le mnémonique est généralement la concaténation du mnémonique de l'engin et
255de celui du groupe de taxon (si un le groupe de taxon en a un).
256     * @param name Libellé du métier.
257Pour un métier de peche, déterminé généralement à partir de la concaténation du libellé de l'engin,
258de la chaine " à ", puis du libellé du groupe de taxon.
259     * @param description Description longue du métier
260     * @param comments 
261     * @param updateDate 
262     * @return Metier
263     */
264    public Metier create(
265        String label,
266        String name,
267        String description,
268        String comments,
269        Timestamp updateDate);
270
271    /**
272     * <p>
273     * Does the same thing as {@link #create(String, String, String, String, Timestamp)} with an
274     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
275     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
276     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
277     * transform the entity (into a value object for example). By default, transformation does
278     * not occur.
279     * </p>
280     * @param transform
281     * @param label Pour un métier de peche, le mnémonique est généralement la concaténation du mnémonique de l'engin et
282de celui du groupe de taxon (si un le groupe de taxon en a un).
283     * @param name Libellé du métier.
284Pour un métier de peche, déterminé généralement à partir de la concaténation du libellé de l'engin,
285de la chaine " à ", puis du libellé du groupe de taxon.
286     * @param description Description longue du métier
287     * @param comments 
288     * @param updateDate 
289     * @return Metier
290     */
291    public Object create(
292        int transform,
293        String label,
294        String name,
295        String description,
296        String comments,
297        Timestamp updateDate);
298
299    /**
300     * <p>
301     * Creates a new <code>Metier</code>
302     * instance from only <strong>required</strong> properties (attributes
303     * and association ends) and adds it to the persistent store.
304     * </p>
305     * @param name
306     * @param status
307     * @param updateDate
308     * @param validityStatus
309     * @return Metier
310     */
311    public Metier create(
312        String name,
313        Status status,
314        Timestamp updateDate,
315        ValidityStatus validityStatus);
316
317    /**
318     * <p>
319     * Does the same thing as {@link #create(String, Timestamp)} with an
320     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
321     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
322     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
323     * transform the entity (into a value object for example). By default, transformation does
324     * not occur.
325     * </p>
326     * @param transform flag to determine transformation type.
327     * @param name
328     * @param status
329     * @param updateDate
330     * @param validityStatus
331     * @return Object
332     */
333    public Object create(
334        int transform,
335        String name,
336        Status status,
337        Timestamp updateDate,
338        ValidityStatus validityStatus);
339
340    /**
341     * Updates the <code>metier</code> instance in the persistent store.
342     * @param metier
343     */
344    public void update(Metier metier);
345
346    /**
347     * Updates all instances in the <code>entities</code> collection in the persistent store.
348     * @param entities
349     */
350    public void update(Collection<Metier> entities);
351
352    /**
353     * Removes the instance of Metier from the persistent store.
354     * @param metier
355     */
356    public void remove(Metier metier);
357
358    /**
359     * Removes the instance of Metier having the given
360     * <code>identifier</code> from the persistent store.
361     * @param id
362     */
363    public void remove(Integer id);
364
365    /**
366     * Removes all entities in the given <code>entities</code> collection.
367     * @param entities
368     */
369    public void remove(Collection<Metier> entities);
370
371
372    /**
373     * Does the same thing as {@link #search(int, Search)} but with an
374     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
375     * limit your data to a specified page number and size.
376     *
377     * @param transform the transformation flag.
378     * @param pageNumber the page number in the data to retrieve
379     * @param pageSize the size of the page to retrieve.
380     * @param search the search object which provides the search parameters and pagination specification.
381     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
382     */
383    public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
384
385    /**
386     * Does the same thing as {@link #search(Search)} but with an
387     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
388     * limit your data to a specified page number and size.
389     *
390     * @param pageNumber the page number in the data to retrieve
391     * @param pageSize the size of the page to retrieve.
392     * @param search the search object which provides the search parameters and pagination specification.
393     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
394     */
395    public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
396
397    /**
398     * Does the same thing as {@link #search(Search)} but with an
399     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
400     * finder results will <strong>NOT</strong> be transformed during retrieval.
401     * If this flag is any of the other constants defined here
402     * then results <strong>WILL BE</strong> passed through an operation which can optionally
403     * transform the entities (into value objects for example). By default, transformation does
404     * not occur.
405     *
406     * @param transform the transformation flag.
407     * @param search the search object which provides the search parameters and pagination specification.
408     * @return any found results from the search.
409     */
410    public Set<?> search(final int transform, final Search search);
411
412    /**
413     * Performs a search using the parameters specified in the given <code>search</code> object.
414     *
415     * @param search the search object which provides the search parameters and pagination specification.
416     * @return any found results from the search.
417     */
418    public Set<Metier> search(final Search search);
419
420    /**
421     * Allows transformation of entities into value objects
422     * (or something else for that matter), when the <code>transform</code>
423     * flag is set to one of the constants defined in <code>fr.ifremer.adagio.core.dao.referential.metier.MetierDao</code>, please note
424     * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
425     * will be returned.
426     *
427     * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
428     *
429     * @param transform one of the constants declared in {@link fr.ifremer.adagio.core.dao.referential.metier.MetierDao}
430     * @param entity an entity that was found
431     * @return the transformed entity (i.e. new value object, etc)
432     * @see #transformEntities(int,Collection)
433     */
434    public Object transformEntity(final int transform, final Metier entity);
435
436    /**
437     * Transforms a collection of entities using the
438     * {@link #transformEntity(int,Metier)}
439     * method. This method does not instantiate a new collection.
440     * <p>
441     * This method is to be used internally only.
442     *
443     * @param transform one of the constants declared in <code>fr.ifremer.adagio.core.dao.referential.metier.MetierDao</code>
444     * @param entities the collection of entities to transform
445     * @see #transformEntity(int,Metier)
446     */
447    public void transformEntities(final int transform, final Collection<?> entities);
448
449    /**
450     * Searches for a single instance of Metier.
451     * @param label the unique label to be used in the search.'
452     * @return a single instance of Metier.
453     */
454    public Metier searchUniqueLabel(final String label);
455
456    /**
457     * Searches for a single instance of Metier.
458     * @param transform the transformation flag.
459     * @param label the unique label to be used in the search.
460     * @return a value object according the transformation flag.
461     */
462    public Object searchUniqueLabel(final int transform, final String label);
463
464    // spring-dao merge-point
465}