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.administration.user;
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 java.sql.Timestamp;
033import java.util.Collection;
034import java.util.Set;
035import org.andromda.spring.PaginationResult;
036
037/**
038 * @deprecated  Use Program2person instead
039 * ATTENTION : NE PLUS UTILISER les portefeuilles dans les nouveaux développements (utiliser à la
040 * place les privilèves sur les programmes)
041 * Portefeuille de navires.
042 * Il peut s'agir d'un portefeuille de différent type (enquete d'activité, marées observées en mer,
043 * campagne en mer, etc.)
044 * Gestion des droits :
045 * - Un portefeuille est géré par un seul utilisateur, qui à les droits de lecture/écriture.
046 * - Un portefeuille peut etre supervisé par une tierce personne, qui aura également les droits de
047 * lecture/écriture sur les données du portefeuille.
048 * - Un portefeuille peut avoir plusieurs utilisateurs avec des droits de consultation uniquement
049 * (lecture seule) sur ces données.
050 * @see ManagedData
051 */
052public interface ManagedDataDao
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 ManagedData}
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 ManagedData from the persistent store.
074     * @param id
075     * @return ManagedData
076     */
077    public ManagedData 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 ManagedData from the persistent store.
097     * @param id
098     * @return ManagedData
099     */
100    public ManagedData 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 ManagedData}.
120     *
121     * @return the loaded entities.
122     */
123    public Collection<ManagedData> 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 ManagedData and adds it to the persistent store.
171     * @param managedData
172     * @return ManagedData
173     */
174    public ManagedData create(ManagedData managedData);
175
176    /**
177     * <p>
178     * Does the same thing as {@link #create(ManagedData)} 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 managedData
187     * @return Object
188     */
189    public Object create(int transform, ManagedData managedData);
190
191    /**
192     * Creates a new instance of ManagedData and adds
193     * from the passed in <code>entities</code> collection
194     *
195     * @param entities the collection of ManagedData
196     * instances to create.
197     *
198     * @return the created instances.
199     */
200    public Collection<ManagedData> create(Collection<ManagedData> entities);
201
202    /**
203     * <p>
204     * Does the same thing as {@link #create(ManagedData)} 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<ManagedData> entities);
216
217    /**
218     * <p>
219     * Creates a new <code>ManagedData</code>
220     * instance from <strong>all</strong> attributes and adds it to
221     * the persistent store.
222     * </p>
223     * @param updateDate 
224     * @return ManagedData
225     */
226    public ManagedData create(
227        Timestamp updateDate);
228
229    /**
230     * <p>
231     * Does the same thing as {@link #create(Timestamp)} with an
232     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
233     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
234     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
235     * transform the entity (into a value object for example). By default, transformation does
236     * not occur.
237     * </p>
238     * @param transform
239     * @param updateDate 
240     * @return ManagedData
241     */
242    public Object create(
243        int transform,
244        Timestamp updateDate);
245
246    /**
247     * <p>
248     * Creates a new <code>ManagedData</code>
249     * instance from only <strong>required</strong> properties (attributes
250     * and association ends) and adds it to the persistent store.
251     * </p>
252     * @param managedDataType
253     * @param managerUser
254     * @param updateDate
255     * @return ManagedData
256     */
257    public ManagedData create(
258        ManagedDataType managedDataType,
259        Person managerUser,
260        Timestamp updateDate);
261
262    /**
263     * <p>
264     * Does the same thing as {@link #create(Timestamp)} with an
265     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
266     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
267     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
268     * transform the entity (into a value object for example). By default, transformation does
269     * not occur.
270     * </p>
271     * @param transform flag to determine transformation type.
272     * @param managedDataType
273     * @param managerUser
274     * @param updateDate
275     * @return Object
276     */
277    public Object create(
278        int transform,
279        ManagedDataType managedDataType,
280        Person managerUser,
281        Timestamp updateDate);
282
283    /**
284     * Updates the <code>managedData</code> instance in the persistent store.
285     * @param managedData
286     */
287    public void update(ManagedData managedData);
288
289    /**
290     * Updates all instances in the <code>entities</code> collection in the persistent store.
291     * @param entities
292     */
293    public void update(Collection<ManagedData> entities);
294
295    /**
296     * Removes the instance of ManagedData from the persistent store.
297     * @param managedData
298     */
299    public void remove(ManagedData managedData);
300
301    /**
302     * Removes the instance of ManagedData having the given
303     * <code>identifier</code> from the persistent store.
304     * @param id
305     */
306    public void remove(Integer id);
307
308    /**
309     * Removes all entities in the given <code>entities</code> collection.
310     * @param entities
311     */
312    public void remove(Collection<ManagedData> entities);
313
314
315    /**
316     * Does the same thing as {@link #search(int, Search)} but with an
317     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
318     * limit your data to a specified page number and size.
319     *
320     * @param transform the transformation flag.
321     * @param pageNumber the page number in the data to retrieve
322     * @param pageSize the size of the page to retrieve.
323     * @param search the search object which provides the search parameters and pagination specification.
324     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
325     */
326    public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
327
328    /**
329     * Does the same thing as {@link #search(Search)} but with an
330     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
331     * limit your data to a specified page number and size.
332     *
333     * @param pageNumber the page number in the data to retrieve
334     * @param pageSize the size of the page to retrieve.
335     * @param search the search object which provides the search parameters and pagination specification.
336     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
337     */
338    public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
339
340    /**
341     * Does the same thing as {@link #search(Search)} but with an
342     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
343     * finder results will <strong>NOT</strong> be transformed during retrieval.
344     * If this flag is any of the other constants defined here
345     * then results <strong>WILL BE</strong> passed through an operation which can optionally
346     * transform the entities (into value objects for example). By default, transformation does
347     * not occur.
348     *
349     * @param transform the transformation flag.
350     * @param search the search object which provides the search parameters and pagination specification.
351     * @return any found results from the search.
352     */
353    public Set<?> search(final int transform, final Search search);
354
355    /**
356     * Performs a search using the parameters specified in the given <code>search</code> object.
357     *
358     * @param search the search object which provides the search parameters and pagination specification.
359     * @return any found results from the search.
360     */
361    public Set<ManagedData> search(final Search search);
362
363    /**
364     * Allows transformation of entities into value objects
365     * (or something else for that matter), when the <code>transform</code>
366     * flag is set to one of the constants defined in <code>fr.ifremer.adagio.core.dao.administration.user.ManagedDataDao</code>, please note
367     * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
368     * will be returned.
369     *
370     * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
371     *
372     * @param transform one of the constants declared in {@link fr.ifremer.adagio.core.dao.administration.user.ManagedDataDao}
373     * @param entity an entity that was found
374     * @return the transformed entity (i.e. new value object, etc)
375     * @see #transformEntities(int,Collection)
376     */
377    public Object transformEntity(final int transform, final ManagedData entity);
378
379    /**
380     * Transforms a collection of entities using the
381     * {@link #transformEntity(int,ManagedData)}
382     * method. This method does not instantiate a new collection.
383     * <p>
384     * This method is to be used internally only.
385     *
386     * @param transform one of the constants declared in <code>fr.ifremer.adagio.core.dao.administration.user.ManagedDataDao</code>
387     * @param entities the collection of entities to transform
388     * @see #transformEntity(int,ManagedData)
389     */
390    public void transformEntities(final int transform, final Collection<?> entities);
391
392    // spring-dao merge-point
393}