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.quadrige2.core.dao.referential;
7
8 /*-
9 * #%L
10 * Quadrige2 Core :: Server API
11 * %%
12 * Copyright (C) 2017 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
29 import fr.ifremer.quadrige2.core.dao.Search;
30 import java.sql.Timestamp;
31 import java.util.Collection;
32 import java.util.Date;
33 import java.util.Set;
34 import org.andromda.spring.PaginationResult;
35
36 /**
37 * Liste l'ensemble des unités de mesure.
38 * @see Unit
39 */
40 public interface UnitDao
41 {
42 /**
43 * This constant is used as a transformation flag; entities can be converted automatically into value objects
44 * or other types, different methods in a class implementing this interface support this feature: look for
45 * an <code>int</code> parameter called <code>transform</code>.
46 * <p>
47 * This specific flag denotes no transformation will occur.
48 */
49 public static final int TRANSFORM_NONE = 0;
50
51
52 /**
53 * Transforms the given results to a collection of {@link Unit}
54 * instances (this is useful when the returned results contains a row of data and you want just entities only).
55 *
56 * @param results the query results.
57 */
58 public void toEntities(final Collection<?> results);
59
60 /**
61 * Gets an instance of Unit from the persistent store.
62 * @param unitId
63 * @return Unit
64 */
65 public Unit get(Integer unitId);
66
67 /**
68 * <p>
69 * Does the same thing as {@link #get(Integer)} with an
70 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
71 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
72 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
73 * optionally transform the entity (into a value object for example). By default, transformation does
74 * not occur.
75 * </p>
76 *
77 * @param transform flag to determine transformation type.
78 * @param unitId the identifier of the entity to get.
79 * @return either the entity or the object transformed from the entity.
80 */
81 public Object get(int transform, Integer unitId);
82
83 /**
84 * Loads an instance of Unit from the persistent store.
85 * @param unitId
86 * @return Unit
87 */
88 public Unit load(Integer unitId);
89
90 /**
91 * <p>
92 * Does the same thing as {@link #load(Integer)} with an
93 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
94 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
95 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
96 * optionally transform the entity (into a value object for example). By default, transformation does
97 * not occur.
98 * </p>
99 *
100 * @param transform flag to determine transformation type.
101 * @param unitId the identifier of the entity to load.
102 * @return either the entity or the object transformed from the entity.
103 */
104 public Object load(int transform, Integer unitId);
105
106 /**
107 * Loads all entities of type {@link Unit}.
108 *
109 * @return the loaded entities.
110 */
111 public Collection<Unit> loadAll();
112
113 /**
114 * <p>
115 * Does the same thing as {@link #loadAll()} with an
116 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
117 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
118 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
119 * transform the entity (into a value object for example). By default, transformation does
120 * not occur.
121 * </p>
122 *
123 * @param transform the flag indicating what transformation to use.
124 * @return the loaded entities.
125 */
126 public Collection<?> loadAll(final int transform);
127
128 /**
129 * <p>
130 * Does the same thing as {@link #loadAll()} with an
131 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
132 * 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
133 * page retrieved.
134 * </p>
135 *
136 * @param pageNumber the page number to retrieve when paging results.
137 * @param pageSize the size of the page to retrieve when paging results.
138 * @return the loaded entities.
139 */
140 public Collection<?> loadAll(final int pageNumber, final int pageSize);
141
142 /**
143 * <p>
144 * Does the same thing as {@link #loadAll(int)} with an
145 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
146 * 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
147 * page retrieved.
148 * </p>
149 *
150 * @param transform the flag indicating what transformation to use.
151 * @param pageNumber the page number to retrieve when paging results.
152 * @param pageSize the size of the page to retrieve when paging results.
153 * @return the loaded entities.
154 */
155 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
156
157 /**
158 * Creates an instance of Unit and adds it to the persistent store.
159 * @param unit
160 * @return Unit
161 */
162 public Unit create(Unit unit);
163
164 /**
165 * <p>
166 * Does the same thing as {@link #create(Unit)} with an
167 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
168 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
169 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
170 * transform the entity (into a value object for example). By default, transformation does
171 * not occur.
172 * </p>
173 * @param transform
174 * @param unit
175 * @return Object
176 */
177 public Object create(int transform, Unit unit);
178
179 /**
180 * Creates a new instance of Unit and adds
181 * from the passed in <code>entities</code> collection
182 *
183 * @param entities the collection of Unit
184 * instances to create.
185 *
186 * @return the created instances.
187 */
188 public Collection<Unit> create(Collection<Unit> entities);
189
190 /**
191 * <p>
192 * Does the same thing as {@link #create(Unit)} with an
193 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
194 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
195 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
196 * transform the entities (into value objects for example). By default, transformation does
197 * not occur.
198 * </p>
199 * @param transform
200 * @param entities
201 * @return Collection
202 */
203 public Collection<?> create(int transform, Collection<Unit> entities);
204
205 /**
206 * <p>
207 * Creates a new <code>Unit</code>
208 * instance from <strong>all</strong> attributes and adds it to
209 * the persistent store.
210 * </p>
211 * @param unitNm Libellé de l'unité (kilogramme, ...)
212 * @param unitSymbol Symbole de l'unité (kg, cm, ...)
213 * @param unitCreationDt Date de création de l'unité
214 * @param updateDt Date de maj de l'unité
215 * @return Unit
216 */
217 public Unit create(
218 String unitNm,
219 String unitSymbol,
220 Date unitCreationDt,
221 Timestamp updateDt);
222
223 /**
224 * <p>
225 * Does the same thing as {@link #create(String, String, Date, Timestamp)} with an
226 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
227 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
228 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
229 * transform the entity (into a value object for example). By default, transformation does
230 * not occur.
231 * </p>
232 * @param transform
233 * @param unitNm Libellé de l'unité (kilogramme, ...)
234 * @param unitSymbol Symbole de l'unité (kg, cm, ...)
235 * @param unitCreationDt Date de création de l'unité
236 * @param updateDt Date de maj de l'unité
237 * @return Unit
238 */
239 public Object create(
240 int transform,
241 String unitNm,
242 String unitSymbol,
243 Date unitCreationDt,
244 Timestamp updateDt);
245
246 /**
247 * <p>
248 * Creates a new <code>Unit</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 unitNm
253 * @param updateDt
254 * @param status
255 * @return Unit
256 */
257 public Unit create(
258 String unitNm,
259 Timestamp updateDt,
260 Status status);
261
262 /**
263 * <p>
264 * Does the same thing as {@link #create(String, 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 unitNm
273 * @param updateDt
274 * @param status
275 * @return Object
276 */
277 public Object create(
278 int transform,
279 String unitNm,
280 Timestamp updateDt,
281 Status status);
282
283 /**
284 * Updates the <code>unit</code> instance in the persistent store.
285 * @param unit
286 */
287 public void update(Unit unit);
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<Unit> entities);
294
295 /**
296 * Removes the instance of Unit from the persistent store.
297 * @param unit
298 */
299 public void remove(Unit unit);
300
301 /**
302 * Removes the instance of Unit having the given
303 * <code>identifier</code> from the persistent store.
304 * @param unitId
305 */
306 public void remove(Integer unitId);
307
308 /**
309 * Removes all entities in the given <code>entities</code> collection.
310 * @param entities
311 */
312 public void remove(Collection<Unit> 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<Unit> 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.quadrige2.core.dao.referential.UnitDao</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.quadrige2.core.dao.referential.UnitDao}
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 Unit entity);
378
379 /**
380 * Transforms a collection of entities using the
381 * {@link #transformEntity(int,Unit)}
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.quadrige2.core.dao.referential.UnitDao</code>
387 * @param entities the collection of entities to transform
388 * @see #transformEntity(int,Unit)
389 */
390 public void transformEntities(final int transform, final Collection<?> entities);
391
392 // spring-dao merge-point
393 }