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.data.link;
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.LinkedItemType;
033import fr.ifremer.adagio.core.dao.referential.QualityFlag;
034import java.sql.Timestamp;
035import java.util.Collection;
036import java.util.Date;
037import java.util.Set;
038import org.andromda.spring.PaginationResult;
039
040/**
041 * <html>
042 * <head>
043 * <style>
044 * p {padding:0px; margin:0px;}
045 * </style>
046 * </head>
047 * <body>
048 * <p>
049 * Rapprochement d'une entité d'un type donné à une autre, qui peut etre ou
050 * non du meme type.
051 * </p>
052 * <p>
053 * </p>
054 * <p>
055 * Cette classe permet de gérer des objets ayant un identifiant numérique (<i>objectId</i>)
056 * ou un code alphanumérique (<i>objectCode - exemple : Vessel</i>).
057 * L'utilisiation du code ou de l'identifiant est exclusive.
058 * </p>
059 * <p>
060 * </p>
061 * <p>
062 * Un rapprochement peut avoir une période de validité (Optionnel).
063 * </p>
064 * <p>
065 * </p>
066 * <p>
067 * Exemple d'utilisation : A partir des données VMS, on récupère des
068 * informations de navire (Pavillon, nom, dates, etc.) stockées sous la
069 * forme d'un navire (Vessel + VesselRegistrationPeriod, etc); après
070 * chargement des données VMS, un outil de rapprochement permet de
071 * retrouver (ou pas) le navire du fichier flotte national correspondant.
072 * La correspondance trouvée est stockée dans <i>LinkedItem</i>.
073 * A l'exportation des données VMS depuis Adagio, cela permet de restituer
074 * les informations sur le navire telle que présentes dans le flux VMS
075 * d'origine.
076 * </p>
077 * </body>
078 * </html>
079 * @see LinkedItem
080 */
081public interface LinkedItemDao
082{
083    /**
084     * This constant is used as a transformation flag; entities can be converted automatically into value objects
085     * or other types, different methods in a class implementing this interface support this feature: look for
086     * an <code>int</code> parameter called <code>transform</code>.
087     * <p>
088     * This specific flag denotes no transformation will occur.
089     */
090    public static final int TRANSFORM_NONE = 0;
091
092
093    /**
094     * Transforms the given results to a collection of {@link LinkedItem}
095     * instances (this is useful when the returned results contains a row of data and you want just entities only).
096     *
097     * @param results the query results.
098     */
099    public void toEntities(final Collection<?> results);
100
101    /**
102     * Gets an instance of LinkedItem from the persistent store.
103     * @param id
104     * @return LinkedItem
105     */
106    public LinkedItem get(Integer id);
107
108    /**
109     * <p>
110     * Does the same thing as {@link #get(Integer)} with an
111     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
112     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
113     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
114     * optionally transform the entity (into a value object for example). By default, transformation does
115     * not occur.
116     * </p>
117     *
118     * @param transform flag to determine transformation type.
119     * @param id the identifier of the entity to get.
120     * @return either the entity or the object transformed from the entity.
121     */
122    public Object get(int transform, Integer id);
123
124    /**
125     * Loads an instance of LinkedItem from the persistent store.
126     * @param id
127     * @return LinkedItem
128     */
129    public LinkedItem load(Integer id);
130
131    /**
132     * <p>
133     * Does the same thing as {@link #load(Integer)} with an
134     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
135     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
136     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
137     * optionally transform the entity (into a value object for example). By default, transformation does
138     * not occur.
139     * </p>
140     *
141     * @param transform flag to determine transformation type.
142     * @param id the identifier of the entity to load.
143     * @return either the entity or the object transformed from the entity.
144     */
145    public Object load(int transform, Integer id);
146
147    /**
148     * Loads all entities of type {@link LinkedItem}.
149     *
150     * @return the loaded entities.
151     */
152    public Collection<LinkedItem> loadAll();
153
154    /**
155     * <p>
156     * Does the same thing as {@link #loadAll()} with an
157     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
158     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
159     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
160     * transform the entity (into a value object for example). By default, transformation does
161     * not occur.
162     * </p>
163     *
164     * @param transform the flag indicating what transformation to use.
165     * @return the loaded entities.
166     */
167    public Collection<?> loadAll(final int transform);
168
169    /**
170     * <p>
171     * Does the same thing as {@link #loadAll()} with an
172     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
173     * 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
174     * page retrieved.
175     * </p>
176     *
177     * @param pageNumber the page number to retrieve when paging results.
178     * @param pageSize the size of the page to retrieve when paging results.
179     * @return the loaded entities.
180     */
181    public Collection<?> loadAll(final int pageNumber, final int pageSize);
182
183    /**
184     * <p>
185     * Does the same thing as {@link #loadAll(int)} with an
186     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
187     * 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
188     * page retrieved.
189     * </p>
190     *
191     * @param transform the flag indicating what transformation to use.
192     * @param pageNumber the page number to retrieve when paging results.
193     * @param pageSize the size of the page to retrieve when paging results.
194     * @return the loaded entities.
195     */
196    public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
197
198    /**
199     * Creates an instance of LinkedItem and adds it to the persistent store.
200     * @param linkedItem
201     * @return LinkedItem
202     */
203    public LinkedItem create(LinkedItem linkedItem);
204
205    /**
206     * <p>
207     * Does the same thing as {@link #create(LinkedItem)} with an
208     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
209     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
210     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
211     * transform the entity (into a value object for example). By default, transformation does
212     * not occur.
213     * </p>
214     * @param transform
215     * @param linkedItem
216     * @return Object
217     */
218    public Object create(int transform, LinkedItem linkedItem);
219
220    /**
221     * Creates a new instance of LinkedItem and adds
222     * from the passed in <code>entities</code> collection
223     *
224     * @param entities the collection of LinkedItem
225     * instances to create.
226     *
227     * @return the created instances.
228     */
229    public Collection<LinkedItem> create(Collection<LinkedItem> entities);
230
231    /**
232     * <p>
233     * Does the same thing as {@link #create(LinkedItem)} with an
234     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
235     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
236     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
237     * transform the entities (into value objects for example). By default, transformation does
238     * not occur.
239     * </p>
240     * @param transform
241     * @param entities
242     * @return Collection
243     */
244    public Collection<?> create(int transform, Collection<LinkedItem> entities);
245
246    /**
247     * <p>
248     * Creates a new <code>LinkedItem</code>
249     * instance from <strong>all</strong> attributes and adds it to
250     * the persistent store.
251     * </p>
252     * @param fromObjectId <html>
253<head>
254</head>
255<body>
256<p>
257Identifiant interne d'une des deux entit&#233;s rapproch&#233;es.
258</p>
259<p>
260Le type d'entit&#233; doit correspondre &#224; celui d&#233;fini dans
261<i>LinkedItemType.fromObjectType</i>.
262</p>
263</body>
264</html>
265     * @param fromObjectCode 
266     * @param toObjectId <html>
267<head>
268</head>
269<body>
270<p>
271Identifiant interne d'une des deux entit&#233;s rapproch&#233;es.
272</p>
273<p>
274Le type d'entit&#233; doit correspondre &#224; celui d&#233;fini dans
275<i>LinkedItemType.toObjectType</i>.
276</p>
277</body>
278</html>
279     * @param toObjectCode 
280     * @param startDate Date de début de validité du rapprochement (optionnel).
281     * @param endDate Date de fin de validité du rapprochement (optionnel).
282Doit être vide, si startDate est vide.
283     * @param updateDate Date de dernière modification (Mise à jour automatiquement par le système).
284     * @return LinkedItem
285     */
286    public LinkedItem create(
287        Integer fromObjectId,
288        String fromObjectCode,
289        Integer toObjectId,
290        String toObjectCode,
291        Date startDate,
292        Date endDate,
293        Timestamp updateDate);
294
295    /**
296     * <p>
297     * Does the same thing as {@link #create(Integer, String, Integer, String, Date, Date, Timestamp)} with an
298     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
299     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
300     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
301     * transform the entity (into a value object for example). By default, transformation does
302     * not occur.
303     * </p>
304     * @param transform
305     * @param fromObjectId <html>
306<head>
307</head>
308<body>
309<p>
310Identifiant interne d'une des deux entit&#233;s rapproch&#233;es.
311</p>
312<p>
313Le type d'entit&#233; doit correspondre &#224; celui d&#233;fini dans
314<i>LinkedItemType.fromObjectType</i>.
315</p>
316</body>
317</html>
318     * @param fromObjectCode 
319     * @param toObjectId <html>
320<head>
321</head>
322<body>
323<p>
324Identifiant interne d'une des deux entit&#233;s rapproch&#233;es.
325</p>
326<p>
327Le type d'entit&#233; doit correspondre &#224; celui d&#233;fini dans
328<i>LinkedItemType.toObjectType</i>.
329</p>
330</body>
331</html>
332     * @param toObjectCode 
333     * @param startDate Date de début de validité du rapprochement (optionnel).
334     * @param endDate Date de fin de validité du rapprochement (optionnel).
335Doit être vide, si startDate est vide.
336     * @param updateDate Date de dernière modification (Mise à jour automatiquement par le système).
337     * @return LinkedItem
338     */
339    public Object create(
340        int transform,
341        Integer fromObjectId,
342        String fromObjectCode,
343        Integer toObjectId,
344        String toObjectCode,
345        Date startDate,
346        Date endDate,
347        Timestamp updateDate);
348
349    /**
350     * <p>
351     * Creates a new <code>LinkedItem</code>
352     * instance from only <strong>required</strong> properties (attributes
353     * and association ends) and adds it to the persistent store.
354     * </p>
355     * @param linkedItemType
356     * @param qualityFlag
357     * @param updateDate
358     * @return LinkedItem
359     */
360    public LinkedItem create(
361        LinkedItemType linkedItemType,
362        QualityFlag qualityFlag,
363        Timestamp updateDate);
364
365    /**
366     * <p>
367     * Does the same thing as {@link #create(Timestamp)} with an
368     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
369     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
370     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
371     * transform the entity (into a value object for example). By default, transformation does
372     * not occur.
373     * </p>
374     * @param transform flag to determine transformation type.
375     * @param linkedItemType
376     * @param qualityFlag
377     * @param updateDate
378     * @return Object
379     */
380    public Object create(
381        int transform,
382        LinkedItemType linkedItemType,
383        QualityFlag qualityFlag,
384        Timestamp updateDate);
385
386    /**
387     * Updates the <code>linkedItem</code> instance in the persistent store.
388     * @param linkedItem
389     */
390    public void update(LinkedItem linkedItem);
391
392    /**
393     * Updates all instances in the <code>entities</code> collection in the persistent store.
394     * @param entities
395     */
396    public void update(Collection<LinkedItem> entities);
397
398    /**
399     * Removes the instance of LinkedItem from the persistent store.
400     * @param linkedItem
401     */
402    public void remove(LinkedItem linkedItem);
403
404    /**
405     * Removes the instance of LinkedItem having the given
406     * <code>identifier</code> from the persistent store.
407     * @param id
408     */
409    public void remove(Integer id);
410
411    /**
412     * Removes all entities in the given <code>entities</code> collection.
413     * @param entities
414     */
415    public void remove(Collection<LinkedItem> entities);
416
417
418    /**
419     * Does the same thing as {@link #search(int, Search)} but with an
420     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
421     * limit your data to a specified page number and size.
422     *
423     * @param transform the transformation flag.
424     * @param pageNumber the page number in the data to retrieve
425     * @param pageSize the size of the page to retrieve.
426     * @param search the search object which provides the search parameters and pagination specification.
427     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
428     */
429    public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
430
431    /**
432     * Does the same thing as {@link #search(Search)} but with an
433     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
434     * limit your data to a specified page number and size.
435     *
436     * @param pageNumber the page number in the data to retrieve
437     * @param pageSize the size of the page to retrieve.
438     * @param search the search object which provides the search parameters and pagination specification.
439     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
440     */
441    public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
442
443    /**
444     * Does the same thing as {@link #search(Search)} but with an
445     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
446     * finder results will <strong>NOT</strong> be transformed during retrieval.
447     * If this flag is any of the other constants defined here
448     * then results <strong>WILL BE</strong> passed through an operation which can optionally
449     * transform the entities (into value objects for example). By default, transformation does
450     * not occur.
451     *
452     * @param transform the transformation flag.
453     * @param search the search object which provides the search parameters and pagination specification.
454     * @return any found results from the search.
455     */
456    public Set<?> search(final int transform, final Search search);
457
458    /**
459     * Performs a search using the parameters specified in the given <code>search</code> object.
460     *
461     * @param search the search object which provides the search parameters and pagination specification.
462     * @return any found results from the search.
463     */
464    public Set<LinkedItem> search(final Search search);
465
466    /**
467     * Allows transformation of entities into value objects
468     * (or something else for that matter), when the <code>transform</code>
469     * flag is set to one of the constants defined in <code>fr.ifremer.adagio.core.dao.data.link.LinkedItemDao</code>, please note
470     * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
471     * will be returned.
472     *
473     * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
474     *
475     * @param transform one of the constants declared in {@link fr.ifremer.adagio.core.dao.data.link.LinkedItemDao}
476     * @param entity an entity that was found
477     * @return the transformed entity (i.e. new value object, etc)
478     * @see #transformEntities(int,Collection)
479     */
480    public Object transformEntity(final int transform, final LinkedItem entity);
481
482    /**
483     * Transforms a collection of entities using the
484     * {@link #transformEntity(int,LinkedItem)}
485     * method. This method does not instantiate a new collection.
486     * <p>
487     * This method is to be used internally only.
488     *
489     * @param transform one of the constants declared in <code>fr.ifremer.adagio.core.dao.data.link.LinkedItemDao</code>
490     * @param entities the collection of entities to transform
491     * @see #transformEntity(int,LinkedItem)
492     */
493    public void transformEntities(final int transform, final Collection<?> entities);
494
495    // spring-dao merge-point
496}