1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: SpringDao.vsl in andromda-spring-cartridge.
5 //
6 package fr.ifremer.quadrige3.core.dao.system;
7
8 /*-
9 * #%L
10 * Quadrige3 Core :: Client API
11 * %%
12 * Copyright (C) 2017 - 2024 Ifremer
13 * %%
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * #L%
27 */
28 import fr.ifremer.quadrige3.core.dao.Search;
29 import java.util.Collection;
30 import java.util.Set;
31 import org.andromda.spring.PaginationResult;
32
33 /**
34 * Liste des sélections cartographique.
35 * @see Selection
36 */
37 public interface SelectionDao
38 {
39 /**
40 * This constant is used as a transformation flag; entities can be converted automatically into value objects
41 * or other types, different methods in a class implementing this interface support this feature: look for
42 * an <code>int</code> parameter called <code>transform</code>.
43 * <p>
44 * This specific flag denotes no transformation will occur.
45 */
46 public static final int TRANSFORM_NONE = 0;
47
48
49 /**
50 * Transforms the given results to a collection of {@link Selection}
51 * instances (this is useful when the returned results contains a row of data and you want just entities only).
52 *
53 * @param results the query results.
54 */
55 public void toEntities(final Collection<?> results);
56
57 /**
58 * Gets an instance of Selection from the persistent store.
59 * @param selId
60 * @return Selection
61 */
62 public Selection get(Integer selId);
63
64 /**
65 * <p>
66 * Does the same thing as {@link #get(Integer)} with an
67 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
68 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
69 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
70 * optionally transform the entity (into a value object for example). By default, transformation does
71 * not occur.
72 * </p>
73 *
74 * @param transform flag to determine transformation type.
75 * @param selId the identifier of the entity to get.
76 * @return either the entity or the object transformed from the entity.
77 */
78 public Object get(int transform, Integer selId);
79
80 /**
81 * Loads an instance of Selection from the persistent store.
82 * @param selId
83 * @return Selection
84 */
85 public Selection load(Integer selId);
86
87 /**
88 * <p>
89 * Does the same thing as {@link #load(Integer)} with an
90 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
91 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
92 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
93 * optionally transform the entity (into a value object for example). By default, transformation does
94 * not occur.
95 * </p>
96 *
97 * @param transform flag to determine transformation type.
98 * @param selId the identifier of the entity to load.
99 * @return either the entity or the object transformed from the entity.
100 */
101 public Object load(int transform, Integer selId);
102
103 /**
104 * Loads all entities of type {@link Selection}.
105 *
106 * @return the loaded entities.
107 */
108 public Collection<Selection> loadAll();
109
110 /**
111 * <p>
112 * Does the same thing as {@link #loadAll()} with an
113 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
114 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
115 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
116 * transform the entity (into a value object for example). By default, transformation does
117 * not occur.
118 * </p>
119 *
120 * @param transform the flag indicating what transformation to use.
121 * @return the loaded entities.
122 */
123 public Collection<?> loadAll(final int transform);
124
125 /**
126 * <p>
127 * Does the same thing as {@link #loadAll()} with an
128 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
129 * 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
130 * page retrieved.
131 * </p>
132 *
133 * @param pageNumber the page number to retrieve when paging results.
134 * @param pageSize the size of the page to retrieve when paging results.
135 * @return the loaded entities.
136 */
137 public Collection<?> loadAll(final int pageNumber, final int pageSize);
138
139 /**
140 * <p>
141 * Does the same thing as {@link #loadAll(int)} with an
142 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
143 * 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
144 * page retrieved.
145 * </p>
146 *
147 * @param transform the flag indicating what transformation to use.
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 transform, final int pageNumber, final int pageSize);
153
154 /**
155 * Creates an instance of Selection and adds it to the persistent store.
156 * @param selection
157 * @return Selection
158 */
159 public Selection create(Selection selection);
160
161 /**
162 * <p>
163 * Does the same thing as {@link #create(Selection)} with an
164 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
165 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
166 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
167 * transform the entity (into a value object for example). By default, transformation does
168 * not occur.
169 * </p>
170 * @param transform
171 * @param selection
172 * @return Object
173 */
174 public Object create(int transform, Selection selection);
175
176 /**
177 * Creates a new instance of Selection and adds
178 * from the passed in <code>entities</code> collection
179 *
180 * @param entities the collection of Selection
181 * instances to create.
182 *
183 * @return the created instances.
184 */
185 public Collection<Selection> create(Collection<Selection> entities);
186
187 /**
188 * <p>
189 * Does the same thing as {@link #create(Selection)} with an
190 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
191 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
192 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
193 * transform the entities (into value objects for example). By default, transformation does
194 * not occur.
195 * </p>
196 * @param transform
197 * @param entities
198 * @return Collection
199 */
200 public Collection<?> create(int transform, Collection<Selection> entities);
201
202 /**
203 * <p>
204 * Creates a new <code>Selection</code>
205 * instance from <strong>all</strong> attributes and adds it to
206 * the persistent store.
207 * </p>
208 * @param selSessionId Identifiant de la session utilisateur
209 * @param selPosition Géométries sélectionnées
210 * @return Selection
211 */
212 public Selection create(
213 Integer selSessionId,
214 String selPosition);
215
216 /**
217 * <p>
218 * Does the same thing as {@link #create(Integer, String)} with an
219 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
220 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
221 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
222 * transform the entity (into a value object for example). By default, transformation does
223 * not occur.
224 * </p>
225 * @param transform
226 * @param selSessionId Identifiant de la session utilisateur
227 * @param selPosition Géométries sélectionnées
228 * @return Selection
229 */
230 public Object create(
231 int transform,
232 Integer selSessionId,
233 String selPosition);
234
235
236 /**
237 * Updates the <code>selection</code> instance in the persistent store.
238 * @param selection
239 */
240 public void update(Selection selection);
241
242 /**
243 * Updates all instances in the <code>entities</code> collection in the persistent store.
244 * @param entities
245 */
246 public void update(Collection<Selection> entities);
247
248 /**
249 * Removes the instance of Selection from the persistent store.
250 * @param selection
251 */
252 public void remove(Selection selection);
253
254 /**
255 * Removes the instance of Selection having the given
256 * <code>identifier</code> from the persistent store.
257 * @param selId
258 */
259 public void remove(Integer selId);
260
261 /**
262 * Removes all entities in the given <code>entities</code> collection.
263 * @param entities
264 */
265 public void remove(Collection<Selection> entities);
266
267
268 /**
269 * Does the same thing as {@link #search(int, Search)} but with an
270 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
271 * limit your data to a specified page number and size.
272 *
273 * @param transform the transformation flag.
274 * @param pageNumber the page number in the data to retrieve
275 * @param pageSize the size of the page to retrieve.
276 * @param search the search object which provides the search parameters and pagination specification.
277 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
278 */
279 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
280
281 /**
282 * Does the same thing as {@link #search(Search)} but with an
283 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
284 * limit your data to a specified page number and size.
285 *
286 * @param pageNumber the page number in the data to retrieve
287 * @param pageSize the size of the page to retrieve.
288 * @param search the search object which provides the search parameters and pagination specification.
289 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
290 */
291 public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
292
293 /**
294 * Does the same thing as {@link #search(Search)} but with an
295 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
296 * finder results will <strong>NOT</strong> be transformed during retrieval.
297 * If this flag is any of the other constants defined here
298 * then results <strong>WILL BE</strong> passed through an operation which can optionally
299 * transform the entities (into value objects for example). By default, transformation does
300 * not occur.
301 *
302 * @param transform the transformation flag.
303 * @param search the search object which provides the search parameters and pagination specification.
304 * @return any found results from the search.
305 */
306 public Set<?> search(final int transform, final Search search);
307
308 /**
309 * Performs a search using the parameters specified in the given <code>search</code> object.
310 *
311 * @param search the search object which provides the search parameters and pagination specification.
312 * @return any found results from the search.
313 */
314 public Set<Selection> search(final Search search);
315
316 /**
317 * Allows transformation of entities into value objects
318 * (or something else for that matter), when the <code>transform</code>
319 * flag is set to one of the constants defined in <code>fr.ifremer.quadrige3.core.dao.system.SelectionDao</code>, please note
320 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
321 * will be returned.
322 *
323 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
324 *
325 * @param transform one of the constants declared in {@link fr.ifremer.quadrige3.core.dao.system.SelectionDao}
326 * @param entity an entity that was found
327 * @return the transformed entity (i.e. new value object, etc)
328 * @see #transformEntities(int,Collection)
329 */
330 public Object transformEntity(final int transform, final Selection entity);
331
332 /**
333 * Transforms a collection of entities using the
334 * {@link #transformEntity(int,Selection)}
335 * method. This method does not instantiate a new collection.
336 * <p>
337 * This method is to be used internally only.
338 *
339 * @param transform one of the constants declared in <code>fr.ifremer.quadrige3.core.dao.system.SelectionDao</code>
340 * @param entities the collection of entities to transform
341 * @see #transformEntity(int,Selection)
342 */
343 public void transformEntities(final int transform, final Collection<?> entities);
344
345 // spring-dao merge-point
346 }