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.taxon;
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 * Les documents de référence sont tous les documents qui peuvent apporter des informations
041 * relatives à la classification systématique des taxons (nomenclature, description, synonymie) ou à
042 * la définition des groupes de taxons. Ces documents peuvent être des publications officielles
043 * (articles de revues ou ouvrage), ou bien des notes de laboratoire, rapports internes, etc.
044 * Dans le cas des publications, la référence du document permet de retrouver les sources. En
045 * revanche, pour les notes de labo, documents internes, et autres, il faudra préciser dans la
046 * référence la localisation de la source (quel service ou quel labo, quelle personne de référence
047 * pour se le procurer).
048 * Les références des publications doivent respecter les règles d'édition des bibliographies
049 * (Auteurs, date. Titre. Editeur...).
050 * @see ReferenceDocument
051 */
052public interface ReferenceDocumentDao
053{
054    /**
055     * This constant is used as a transformation flag; entities can be converted automatically into value objects
056     * or other types, different methods in a class implementing this interface support this feature: look for
057     * an <code>int</code> parameter called <code>transform</code>.
058     * <p>
059     * This specific flag denotes no transformation will occur.
060     */
061    public static final int TRANSFORM_NONE = 0;
062
063
064    /**
065     * Transforms the given results to a collection of {@link ReferenceDocument}
066     * instances (this is useful when the returned results contains a row of data and you want just entities only).
067     *
068     * @param results the query results.
069     */
070    public void toEntities(final Collection<?> results);
071
072    /**
073     * Gets an instance of ReferenceDocument from the persistent store.
074     * @param id
075     * @return ReferenceDocument
076     */
077    public ReferenceDocument get(Integer id);
078
079    /**
080     * <p>
081     * Does the same thing as {@link #get(Integer)} with an
082     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
083     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
084     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
085     * optionally transform the entity (into a value object for example). By default, transformation does
086     * not occur.
087     * </p>
088     *
089     * @param transform flag to determine transformation type.
090     * @param id the identifier of the entity to get.
091     * @return either the entity or the object transformed from the entity.
092     */
093    public Object get(int transform, Integer id);
094
095    /**
096     * Loads an instance of ReferenceDocument from the persistent store.
097     * @param id
098     * @return ReferenceDocument
099     */
100    public ReferenceDocument load(Integer id);
101
102    /**
103     * <p>
104     * Does the same thing as {@link #load(Integer)} with an
105     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
106     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
107     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
108     * optionally transform the entity (into a value object for example). By default, transformation does
109     * not occur.
110     * </p>
111     *
112     * @param transform flag to determine transformation type.
113     * @param id the identifier of the entity to load.
114     * @return either the entity or the object transformed from the entity.
115     */
116    public Object load(int transform, Integer id);
117
118    /**
119     * Loads all entities of type {@link ReferenceDocument}.
120     *
121     * @return the loaded entities.
122     */
123    public Collection<ReferenceDocument> loadAll();
124
125    /**
126     * <p>
127     * Does the same thing as {@link #loadAll()} with an
128     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
129     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
130     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
131     * transform the entity (into a value object for example). By default, transformation does
132     * not occur.
133     * </p>
134     *
135     * @param transform the flag indicating what transformation to use.
136     * @return the loaded entities.
137     */
138    public Collection<?> loadAll(final int transform);
139
140    /**
141     * <p>
142     * Does the same thing as {@link #loadAll()} with an
143     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
144     * 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
145     * page retrieved.
146     * </p>
147     *
148     * @param pageNumber the page number to retrieve when paging results.
149     * @param pageSize the size of the page to retrieve when paging results.
150     * @return the loaded entities.
151     */
152    public Collection<?> loadAll(final int pageNumber, final int pageSize);
153
154    /**
155     * <p>
156     * Does the same thing as {@link #loadAll(int)} with an
157     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
158     * 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
159     * page retrieved.
160     * </p>
161     *
162     * @param transform the flag indicating what transformation to use.
163     * @param pageNumber the page number to retrieve when paging results.
164     * @param pageSize the size of the page to retrieve when paging results.
165     * @return the loaded entities.
166     */
167    public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
168
169    /**
170     * Creates an instance of ReferenceDocument and adds it to the persistent store.
171     * @param referenceDocument
172     * @return ReferenceDocument
173     */
174    public ReferenceDocument create(ReferenceDocument referenceDocument);
175
176    /**
177     * <p>
178     * Does the same thing as {@link #create(ReferenceDocument)} with an
179     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
180     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
181     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
182     * transform the entity (into a value object for example). By default, transformation does
183     * not occur.
184     * </p>
185     * @param transform
186     * @param referenceDocument
187     * @return Object
188     */
189    public Object create(int transform, ReferenceDocument referenceDocument);
190
191    /**
192     * Creates a new instance of ReferenceDocument and adds
193     * from the passed in <code>entities</code> collection
194     *
195     * @param entities the collection of ReferenceDocument
196     * instances to create.
197     *
198     * @return the created instances.
199     */
200    public Collection<ReferenceDocument> create(Collection<ReferenceDocument> entities);
201
202    /**
203     * <p>
204     * Does the same thing as {@link #create(ReferenceDocument)} with an
205     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
206     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
207     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
208     * transform the entities (into value objects for example). By default, transformation does
209     * not occur.
210     * </p>
211     * @param transform
212     * @param entities
213     * @return Collection
214     */
215    public Collection<?> create(int transform, Collection<ReferenceDocument> entities);
216
217    /**
218     * <p>
219     * Creates a new <code>ReferenceDocument</code>
220     * instance from <strong>all</strong> attributes and adds it to
221     * the persistent store.
222     * </p>
223     * @param reference Libellé stockant la référence du document. Ceci peut être le nom, l'édition etc.
224     * @param publicationDate Date de parution du document.
225     * @param comments Commentaires divers associés au document de référence.
226     * @param creationDate Date de création système du document de référence. Renseigné automatiquement par le système.
227     * @param updateDate Date de mise à jour système de la référence. Renseigné automatiquement par le système.
228     * @return ReferenceDocument
229     */
230    public ReferenceDocument create(
231        String reference,
232        Date publicationDate,
233        String comments,
234        Date creationDate,
235        Timestamp updateDate);
236
237    /**
238     * <p>
239     * Does the same thing as {@link #create(String, Date, String, Date, Timestamp)} with an
240     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
241     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
242     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
243     * transform the entity (into a value object for example). By default, transformation does
244     * not occur.
245     * </p>
246     * @param transform
247     * @param reference Libellé stockant la référence du document. Ceci peut être le nom, l'édition etc.
248     * @param publicationDate Date de parution du document.
249     * @param comments Commentaires divers associés au document de référence.
250     * @param creationDate Date de création système du document de référence. Renseigné automatiquement par le système.
251     * @param updateDate Date de mise à jour système de la référence. Renseigné automatiquement par le système.
252     * @return ReferenceDocument
253     */
254    public Object create(
255        int transform,
256        String reference,
257        Date publicationDate,
258        String comments,
259        Date creationDate,
260        Timestamp updateDate);
261
262    /**
263     * <p>
264     * Creates a new <code>ReferenceDocument</code>
265     * instance from only <strong>required</strong> properties (attributes
266     * and association ends) and adds it to the persistent store.
267     * </p>
268     * @param authors
269     * @param creationDate
270     * @param reference
271     * @param status
272     * @param updateDate
273     * @return ReferenceDocument
274     */
275    public ReferenceDocument create(
276        Collection<Author> authors,
277        Date creationDate,
278        String reference,
279        Status status,
280        Timestamp updateDate);
281
282    /**
283     * <p>
284     * Does the same thing as {@link #create(String, Date, Timestamp)} with an
285     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
286     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
287     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
288     * transform the entity (into a value object for example). By default, transformation does
289     * not occur.
290     * </p>
291     * @param transform flag to determine transformation type.
292     * @param authors
293     * @param creationDate
294     * @param reference
295     * @param status
296     * @param updateDate
297     * @return Object
298     */
299    public Object create(
300        int transform,
301        Collection<Author> authors,
302        Date creationDate,
303        String reference,
304        Status status,
305        Timestamp updateDate);
306
307    /**
308     * Updates the <code>referenceDocument</code> instance in the persistent store.
309     * @param referenceDocument
310     */
311    public void update(ReferenceDocument referenceDocument);
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<ReferenceDocument> entities);
318
319    /**
320     * Removes the instance of ReferenceDocument from the persistent store.
321     * @param referenceDocument
322     */
323    public void remove(ReferenceDocument referenceDocument);
324
325    /**
326     * Removes the instance of ReferenceDocument 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<ReferenceDocument> 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<ReferenceDocument> 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.taxon.ReferenceDocumentDao</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.taxon.ReferenceDocumentDao}
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 ReferenceDocument entity);
402
403    /**
404     * Transforms a collection of entities using the
405     * {@link #transformEntity(int,ReferenceDocument)}
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.taxon.ReferenceDocumentDao</code>
411     * @param entities the collection of entities to transform
412     * @see #transformEntity(int,ReferenceDocument)
413     */
414    public void transformEntities(final int transform, final Collection<?> entities);
415
416    // spring-dao merge-point
417}