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.spatial;
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 * Présence d'un élément d'une liste du référentiel sur une ou plusieurs zones géographiques.
039 * Une ou plusieurs géométrie (ponctuelle, linéraire ou polygonale) peuvent etre définies afin de
040 * géolocaliser un des éléments d'une liste.
041 * Une procédure stockée sous Oracle permet la mise à jour d'un lien vers le référentiel des lieux
042 * (table SPATIAL_ITEM2LOCATION) à partir des géométries définies.
043 * @see SpatialItem
044 */
045public interface SpatialItemDao
046{
047    /**
048     * This constant is used as a transformation flag; entities can be converted automatically into value objects
049     * or other types, different methods in a class implementing this interface support this feature: look for
050     * an <code>int</code> parameter called <code>transform</code>.
051     * <p>
052     * This specific flag denotes no transformation will occur.
053     */
054    public static final int TRANSFORM_NONE = 0;
055
056
057    /**
058     * Transforms the given results to a collection of {@link SpatialItem}
059     * instances (this is useful when the returned results contains a row of data and you want just entities only).
060     *
061     * @param results the query results.
062     */
063    public void toEntities(final Collection<?> results);
064
065    /**
066     * Gets an instance of SpatialItem from the persistent store.
067     * @param id
068     * @return SpatialItem
069     */
070    public SpatialItem get(Integer id);
071
072    /**
073     * <p>
074     * Does the same thing as {@link #get(Integer)} with an
075     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
076     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
077     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
078     * optionally transform the entity (into a value object for example). By default, transformation does
079     * not occur.
080     * </p>
081     *
082     * @param transform flag to determine transformation type.
083     * @param id the identifier of the entity to get.
084     * @return either the entity or the object transformed from the entity.
085     */
086    public Object get(int transform, Integer id);
087
088    /**
089     * Loads an instance of SpatialItem from the persistent store.
090     * @param id
091     * @return SpatialItem
092     */
093    public SpatialItem load(Integer id);
094
095    /**
096     * <p>
097     * Does the same thing as {@link #load(Integer)} with an
098     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
099     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
100     * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
101     * optionally transform the entity (into a value object for example). By default, transformation does
102     * not occur.
103     * </p>
104     *
105     * @param transform flag to determine transformation type.
106     * @param id the identifier of the entity to load.
107     * @return either the entity or the object transformed from the entity.
108     */
109    public Object load(int transform, Integer id);
110
111    /**
112     * Loads all entities of type {@link SpatialItem}.
113     *
114     * @return the loaded entities.
115     */
116    public Collection<SpatialItem> loadAll();
117
118    /**
119     * <p>
120     * Does the same thing as {@link #loadAll()} with an
121     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
122     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
123     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
124     * transform the entity (into a value object for example). By default, transformation does
125     * not occur.
126     * </p>
127     *
128     * @param transform the flag indicating what transformation to use.
129     * @return the loaded entities.
130     */
131    public Collection<?> loadAll(final int transform);
132
133    /**
134     * <p>
135     * Does the same thing as {@link #loadAll()} with an
136     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
137     * 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
138     * page retrieved.
139     * </p>
140     *
141     * @param pageNumber the page number to retrieve when paging results.
142     * @param pageSize the size of the page to retrieve when paging results.
143     * @return the loaded entities.
144     */
145    public Collection<?> loadAll(final int pageNumber, final int pageSize);
146
147    /**
148     * <p>
149     * Does the same thing as {@link #loadAll(int)} with an
150     * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
151     * 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
152     * page retrieved.
153     * </p>
154     *
155     * @param transform the flag indicating what transformation to use.
156     * @param pageNumber the page number to retrieve when paging results.
157     * @param pageSize the size of the page to retrieve when paging results.
158     * @return the loaded entities.
159     */
160    public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
161
162    /**
163     * Creates an instance of SpatialItem and adds it to the persistent store.
164     * @param spatialItem
165     * @return SpatialItem
166     */
167    public SpatialItem create(SpatialItem spatialItem);
168
169    /**
170     * <p>
171     * Does the same thing as {@link #create(SpatialItem)} with an
172     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
173     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
174     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
175     * transform the entity (into a value object for example). By default, transformation does
176     * not occur.
177     * </p>
178     * @param transform
179     * @param spatialItem
180     * @return Object
181     */
182    public Object create(int transform, SpatialItem spatialItem);
183
184    /**
185     * Creates a new instance of SpatialItem and adds
186     * from the passed in <code>entities</code> collection
187     *
188     * @param entities the collection of SpatialItem
189     * instances to create.
190     *
191     * @return the created instances.
192     */
193    public Collection<SpatialItem> create(Collection<SpatialItem> entities);
194
195    /**
196     * <p>
197     * Does the same thing as {@link #create(SpatialItem)} with an
198     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
199     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
200     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
201     * transform the entities (into value objects for example). By default, transformation does
202     * not occur.
203     * </p>
204     * @param transform
205     * @param entities
206     * @return Collection
207     */
208    public Collection<?> create(int transform, Collection<SpatialItem> entities);
209
210    /**
211     * <p>
212     * Creates a new <code>SpatialItem</code>
213     * instance from <strong>all</strong> attributes and adds it to
214     * the persistent store.
215     * </p>
216     * @param objectId 
217     * @param updateDate 
218     * @return SpatialItem
219     */
220    public SpatialItem create(
221        Integer objectId,
222        Timestamp updateDate);
223
224    /**
225     * <p>
226     * Does the same thing as {@link #create(Integer, Timestamp)} with an
227     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
228     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
229     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
230     * transform the entity (into a value object for example). By default, transformation does
231     * not occur.
232     * </p>
233     * @param transform
234     * @param objectId 
235     * @param updateDate 
236     * @return SpatialItem
237     */
238    public Object create(
239        int transform,
240        Integer objectId,
241        Timestamp updateDate);
242
243    /**
244     * <p>
245     * Creates a new <code>SpatialItem</code>
246     * instance from only <strong>required</strong> properties (attributes
247     * and association ends) and adds it to the persistent store.
248     * </p>
249     * @param objectId
250     * @param spatialItemType
251     * @param updateDate
252     * @return SpatialItem
253     */
254    public SpatialItem create(
255        Integer objectId,
256        SpatialItemType spatialItemType,
257        Timestamp updateDate);
258
259    /**
260     * <p>
261     * Does the same thing as {@link #create(Integer, Timestamp)} with an
262     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
263     * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
264     * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
265     * transform the entity (into a value object for example). By default, transformation does
266     * not occur.
267     * </p>
268     * @param transform flag to determine transformation type.
269     * @param objectId
270     * @param spatialItemType
271     * @param updateDate
272     * @return Object
273     */
274    public Object create(
275        int transform,
276        Integer objectId,
277        SpatialItemType spatialItemType,
278        Timestamp updateDate);
279
280    /**
281     * Updates the <code>spatialItem</code> instance in the persistent store.
282     * @param spatialItem
283     */
284    public void update(SpatialItem spatialItem);
285
286    /**
287     * Updates all instances in the <code>entities</code> collection in the persistent store.
288     * @param entities
289     */
290    public void update(Collection<SpatialItem> entities);
291
292    /**
293     * Removes the instance of SpatialItem from the persistent store.
294     * @param spatialItem
295     */
296    public void remove(SpatialItem spatialItem);
297
298    /**
299     * Removes the instance of SpatialItem having the given
300     * <code>identifier</code> from the persistent store.
301     * @param id
302     */
303    public void remove(Integer id);
304
305    /**
306     * Removes all entities in the given <code>entities</code> collection.
307     * @param entities
308     */
309    public void remove(Collection<SpatialItem> entities);
310
311
312    /**
313     * Does the same thing as {@link #search(int, Search)} but with an
314     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
315     * limit your data to a specified page number and size.
316     *
317     * @param transform the transformation flag.
318     * @param pageNumber the page number in the data to retrieve
319     * @param pageSize the size of the page to retrieve.
320     * @param search the search object which provides the search parameters and pagination specification.
321     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
322     */
323    public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
324
325    /**
326     * Does the same thing as {@link #search(Search)} but with an
327     * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
328     * limit your data to a specified page number and size.
329     *
330     * @param pageNumber the page number in the data to retrieve
331     * @param pageSize the size of the page to retrieve.
332     * @param search the search object which provides the search parameters and pagination specification.
333     * @return any found results from the search wrapped in a {@link PaginationResult} instance.
334     */
335    public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
336
337    /**
338     * Does the same thing as {@link #search(Search)} but with an
339     * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
340     * finder results will <strong>NOT</strong> be transformed during retrieval.
341     * If this flag is any of the other constants defined here
342     * then results <strong>WILL BE</strong> passed through an operation which can optionally
343     * transform the entities (into value objects for example). By default, transformation does
344     * not occur.
345     *
346     * @param transform the transformation flag.
347     * @param search the search object which provides the search parameters and pagination specification.
348     * @return any found results from the search.
349     */
350    public Set<?> search(final int transform, final Search search);
351
352    /**
353     * Performs a search using the parameters specified in the given <code>search</code> object.
354     *
355     * @param search the search object which provides the search parameters and pagination specification.
356     * @return any found results from the search.
357     */
358    public Set<SpatialItem> search(final Search search);
359
360    /**
361     * Allows transformation of entities into value objects
362     * (or something else for that matter), when the <code>transform</code>
363     * flag is set to one of the constants defined in <code>fr.ifremer.adagio.core.dao.referential.spatial.SpatialItemDao</code>, please note
364     * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
365     * will be returned.
366     *
367     * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
368     *
369     * @param transform one of the constants declared in {@link fr.ifremer.adagio.core.dao.referential.spatial.SpatialItemDao}
370     * @param entity an entity that was found
371     * @return the transformed entity (i.e. new value object, etc)
372     * @see #transformEntities(int,Collection)
373     */
374    public Object transformEntity(final int transform, final SpatialItem entity);
375
376    /**
377     * Transforms a collection of entities using the
378     * {@link #transformEntity(int,SpatialItem)}
379     * method. This method does not instantiate a new collection.
380     * <p>
381     * This method is to be used internally only.
382     *
383     * @param transform one of the constants declared in <code>fr.ifremer.adagio.core.dao.referential.spatial.SpatialItemDao</code>
384     * @param entities the collection of entities to transform
385     * @see #transformEntity(int,SpatialItem)
386     */
387    public void transformEntities(final int transform, final Collection<?> entities);
388
389    // spring-dao merge-point
390}