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.pmfm;
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 java.sql.Timestamp;
034import java.util.Collection;
035import java.util.Date;
036import java.util.Set;
037import org.andromda.spring.PaginationResult;
038
039/**
040 * Une fraction analysée est un composant du support sur lequel porte l'analyse.
041 * Les fractions analysées sont généralement des fractions "organiques", au sens d'une
042 * classification par partie d'un même organisme,
043 * ex : foie, écaille, reins, dents, otolithe...
044 * Elles peuvent aussi être un sous ensemble quelconque du support. Par exemple, dans le cas des
045 * engins : le bras, …
046 * Les fractions dites "systématiques", au sens d'une classification systématique (ex : poisson :
047 * Cyprinidae / Cyprinus / Cyprinus carpio...) ne sont pas considérées comme des fractions au sens
048 * de l'entité, mais comme une précision apportée sur l'individu. Représentées par les entités
049 * "taxon" et "groupe de taxon", elles ne font pas partie de la liste des fractions analysées.
050 * Etant une liste de référence, une procédure stricte pour la création de nouvelles fractions
051 * analysées pourra être mise en place (On pourra s'inspirer des procédures utilisées dans
052 * Quadrige2, qui utilisent le référentiel national du SANDRE).
053 * Nombre de lignes : 10
054 * @see Fraction
055 */
056public interface FractionDao
057{
058    /**
059     * This constant is used as a transformation flag; entities can be converted automatically into value objects
060     * or other types, different methods in a class implementing this interface support this feature: look for
061     * an <code>int</code> parameter called <code>transform</code>.
062     * <p>
063     * This specific flag denotes no transformation will occur.
064     */
065    public static final int TRANSFORM_NONE = 0;
066
067
068    /**
069     * Transforms the given results to a collection of {@link Fraction}
070     * instances (this is useful when the returned results contains a row of data and you want just entities only).
071     *
072     * @param results the query results.
073     */
074    public void toEntities(final Collection<?> results);
075
076    /**
077     * Gets an instance of Fraction from the persistent store.
078     * @param id
079     * @return Fraction
080     */
081    public Fraction get(Integer id);
082
083    /**
084     * <p>
085     * Does the same thing as {@link #get(Integer)} with an
086     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
087     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
088     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
089     * optionally transform the entity (into a value object for example). By default, transformation does
090     * not occur.
091     * </p>
092     *
093     * @param transform flag to determine transformation type.
094     * @param id the identifier of the entity to get.
095     * @return either the entity or the object transformed from the entity.
096     */
097    public Object get(int transform, Integer id);
098
099    /**
100     * Loads an instance of Fraction from the persistent store.
101     * @param id
102     * @return Fraction
103     */
104    public Fraction load(Integer id);
105
106    /**
107     * <p>
108     * Does the same thing as {@link #load(Integer)} with an
109     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
110     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
111     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
112     * optionally transform the entity (into a value object for example). By default, transformation does
113     * not occur.
114     * </p>
115     *
116     * @param transform flag to determine transformation type.
117     * @param id the identifier of the entity to load.
118     * @return either the entity or the object transformed from the entity.
119     */
120    public Object load(int transform, Integer id);
121
122    /**
123     * Loads all entities of type {@link Fraction}.
124     *
125     * @return the loaded entities.
126     */
127    public Collection<Fraction> loadAll();
128
129    /**
130     * <p>
131     * Does the same thing as {@link #loadAll()} with an
132     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
133     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
134     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
135     * transform the entity (into a value object for example). By default, transformation does
136     * not occur.
137     * </p>
138     *
139     * @param transform the flag indicating what transformation to use.
140     * @return the loaded entities.
141     */
142    public Collection<?> loadAll(final int transform);
143
144    /**
145     * <p>
146     * Does the same thing as {@link #loadAll()} with an
147     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
148     * 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
149     * page retrieved.
150     * </p>
151     *
152     * @param pageNumber the page number to retrieve when paging results.
153     * @param pageSize the size of the page to retrieve when paging results.
154     * @return the loaded entities.
155     */
156    public Collection<?> loadAll(final int pageNumber, final int pageSize);
157
158    /**
159     * <p>
160     * Does the same thing as {@link #loadAll(int)} with an
161     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
162     * 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
163     * page retrieved.
164     * </p>
165     *
166     * @param transform the flag indicating what transformation to use.
167     * @param pageNumber the page number to retrieve when paging results.
168     * @param pageSize the size of the page to retrieve when paging results.
169     * @return the loaded entities.
170     */
171    public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
172
173    /**
174     * Creates an instance of Fraction and adds it to the persistent store.
175     * @param fraction
176     * @return Fraction
177     */
178    public Fraction create(Fraction fraction);
179
180    /**
181     * <p>
182     * Does the same thing as {@link #create(Fraction)} with an
183     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
184     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
185     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
186     * transform the entity (into a value object for example). By default, transformation does
187     * not occur.
188     * </p>
189     * @param transform
190     * @param fraction
191     * @return Object
192     */
193    public Object create(int transform, Fraction fraction);
194
195    /**
196     * Creates a new instance of Fraction and adds
197     * from the passed in <code>entities</code> collection
198     *
199     * @param entities the collection of Fraction
200     * instances to create.
201     *
202     * @return the created instances.
203     */
204    public Collection<Fraction> create(Collection<Fraction> entities);
205
206    /**
207     * <p>
208     * Does the same thing as {@link #create(Fraction)} with an
209     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
210     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
211     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
212     * transform the entities (into value objects for example). By default, transformation does
213     * not occur.
214     * </p>
215     * @param transform
216     * @param entities
217     * @return Collection
218     */
219    public Collection<?> create(int transform, Collection<Fraction> entities);
220
221    /**
222     * <p>
223     * Creates a new <code>Fraction</code>
224     * instance from <strong>all</strong> attributes and adds it to
225     * the persistent store.
226     * </p>
227     * @param name Description courte de la fraction.
228     * @param description Description longue de la fraction.
229     * @param creationDate 
230     * @param comments 
231     * @param updateDate 
232     * @return Fraction
233     */
234    public Fraction create(
235        String name,
236        String description,
237        Date creationDate,
238        String comments,
239        Timestamp updateDate);
240
241    /**
242     * <p>
243     * Does the same thing as {@link #create(String, String, Date, String, Timestamp)} with an
244     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
245     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
246     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
247     * transform the entity (into a value object for example). By default, transformation does
248     * not occur.
249     * </p>
250     * @param transform
251     * @param name Description courte de la fraction.
252     * @param description Description longue de la fraction.
253     * @param creationDate 
254     * @param comments 
255     * @param updateDate 
256     * @return Fraction
257     */
258    public Object create(
259        int transform,
260        String name,
261        String description,
262        Date creationDate,
263        String comments,
264        Timestamp updateDate);
265
266    /**
267     * <p>
268     * Creates a new <code>Fraction</code>
269     * instance from only <strong>required</strong> properties (attributes
270     * and association ends) and adds it to the persistent store.
271     * </p>
272     * @param creationDate
273     * @param name
274     * @param status
275     * @param updateDate
276     * @return Fraction
277     */
278    public Fraction create(
279        Date creationDate,
280        String name,
281        Status status,
282        Timestamp updateDate);
283
284    /**
285     * <p>
286     * Does the same thing as {@link #create(String, Date, Timestamp)} with an
287     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
288     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
289     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
290     * transform the entity (into a value object for example). By default, transformation does
291     * not occur.
292     * </p>
293     * @param transform flag to determine transformation type.
294     * @param creationDate
295     * @param name
296     * @param status
297     * @param updateDate
298     * @return Object
299     */
300    public Object create(
301        int transform,
302        Date creationDate,
303        String name,
304        Status status,
305        Timestamp updateDate);
306
307    /**
308     * Updates the <code>fraction</code> instance in the persistent store.
309     * @param fraction
310     */
311    public void update(Fraction fraction);
312
313    /**
314     * Updates all instances in the <code>entities</code> collection in the persistent store.
315     * @param entities
316     */
317    public void update(Collection<Fraction> entities);
318
319    /**
320     * Removes the instance of Fraction from the persistent store.
321     * @param fraction
322     */
323    public void remove(Fraction fraction);
324
325    /**
326     * Removes the instance of Fraction having the given
327     * <code>identifier</code> from the persistent store.
328     * @param id
329     */
330    public void remove(Integer id);
331
332    /**
333     * Removes all entities in the given <code>entities</code> collection.
334     * @param entities
335     */
336    public void remove(Collection<Fraction> entities);
337
338
339    /**
340     * Does the same thing as {@link #search(int, Search)} but with an
341     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
342     * limit your data to a specified page number and size.
343     *
344     * @param transform the transformation flag.
345     * @param pageNumber the page number in the data to retrieve
346     * @param pageSize the size of the page to retrieve.
347     * @param search the search object which provides the search parameters and pagination specification.
348     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
349     */
350    public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
351
352    /**
353     * Does the same thing as {@link #search(Search)} but with an
354     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
355     * limit your data to a specified page number and size.
356     *
357     * @param pageNumber the page number in the data to retrieve
358     * @param pageSize the size of the page to retrieve.
359     * @param search the search object which provides the search parameters and pagination specification.
360     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
361     */
362    public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
363
364    /**
365     * Does the same thing as {@link #search(Search)} but with an
366     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
367     * finder results will <strong>NOT</strong> be transformed during retrieval.
368     * If this flag is any of the other constants defined here
369     * then results <strong>WILL BE</strong> passed through an operation which can optionally
370     * transform the entities (into value objects for example). By default, transformation does
371     * not occur.
372     *
373     * @param transform the transformation flag.
374     * @param search the search object which provides the search parameters and pagination specification.
375     * @return any found results from the search.
376     */
377    public Set<?> search(final int transform, final Search search);
378
379    /**
380     * Performs a search using the parameters specified in the given <code>search</code> object.
381     *
382     * @param search the search object which provides the search parameters and pagination specification.
383     * @return any found results from the search.
384     */
385    public Set<Fraction> search(final Search search);
386
387    /**
388     * Allows transformation of entities into value objects
389     * (or something else for that matter), when the <code>transform</code>
390     * flag is set to one of the constants defined in <code>fr.ifremer.adagio.core.dao.referential.pmfm.FractionDao</code>, please note
391     * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
392     * will be returned.
393     *
394     * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
395     *
396     * @param transform one of the constants declared in {@link fr.ifremer.adagio.core.dao.referential.pmfm.FractionDao}
397     * @param entity an entity that was found
398     * @return the transformed entity (i.e. new value object, etc)
399     * @see #transformEntities(int,Collection)
400     */
401    public Object transformEntity(final int transform, final Fraction entity);
402
403    /**
404     * Transforms a collection of entities using the
405     * {@link #transformEntity(int,Fraction)}
406     * method. This method does not instantiate a new collection.
407     * <p>
408     * This method is to be used internally only.
409     *
410     * @param transform one of the constants declared in <code>fr.ifremer.adagio.core.dao.referential.pmfm.FractionDao</code>
411     * @param entities the collection of entities to transform
412     * @see #transformEntity(int,Fraction)
413     */
414    public void transformEntities(final int transform, final Collection<?> entities);
415
416    // spring-dao merge-point
417}