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.data.survey;
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 fr.ifremer.quadrige2.core.dao.administration.user.Department;
31 import fr.ifremer.quadrige2.core.dao.referential.ObservationTypology;
32 import fr.ifremer.quadrige2.core.dao.referential.QualityFlag;
33 import java.sql.Timestamp;
34 import java.util.Collection;
35 import java.util.Date;
36 import java.util.Set;
37 import org.andromda.spring.PaginationResult;
38
39 /**
40 * Liste des observations terrain
41 * @see FieldObservation
42 */
43 public interface FieldObservationDao
44 {
45 /**
46 * This constant is used as a transformation flag; entities can be converted automatically into value objects
47 * or other types, different methods in a class implementing this interface support this feature: look for
48 * an <code>int</code> parameter called <code>transform</code>.
49 * <p>
50 * This specific flag denotes no transformation will occur.
51 */
52 public static final int TRANSFORM_NONE = 0;
53
54
55 /**
56 * Transforms the given results to a collection of {@link FieldObservation}
57 * instances (this is useful when the returned results contains a row of data and you want just entities only).
58 *
59 * @param results the query results.
60 */
61 public void toEntities(final Collection<?> results);
62
63 /**
64 * Gets an instance of FieldObservation from the persistent store.
65 * @param fieldObservId
66 * @return FieldObservation
67 */
68 public FieldObservation get(Integer fieldObservId);
69
70 /**
71 * <p>
72 * Does the same thing as {@link #get(Integer)} with an
73 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
74 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
75 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
76 * optionally transform the entity (into a value object for example). By default, transformation does
77 * not occur.
78 * </p>
79 *
80 * @param transform flag to determine transformation type.
81 * @param fieldObservId the identifier of the entity to get.
82 * @return either the entity or the object transformed from the entity.
83 */
84 public Object get(int transform, Integer fieldObservId);
85
86 /**
87 * Loads an instance of FieldObservation from the persistent store.
88 * @param fieldObservId
89 * @return FieldObservation
90 */
91 public FieldObservation load(Integer fieldObservId);
92
93 /**
94 * <p>
95 * Does the same thing as {@link #load(Integer)} with an
96 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
97 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
98 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
99 * optionally transform the entity (into a value object for example). By default, transformation does
100 * not occur.
101 * </p>
102 *
103 * @param transform flag to determine transformation type.
104 * @param fieldObservId the identifier of the entity to load.
105 * @return either the entity or the object transformed from the entity.
106 */
107 public Object load(int transform, Integer fieldObservId);
108
109 /**
110 * Loads all entities of type {@link FieldObservation}.
111 *
112 * @return the loaded entities.
113 */
114 public Collection<FieldObservation> loadAll();
115
116 /**
117 * <p>
118 * Does the same thing as {@link #loadAll()} with an
119 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
120 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
121 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
122 * transform the entity (into a value object for example). By default, transformation does
123 * not occur.
124 * </p>
125 *
126 * @param transform the flag indicating what transformation to use.
127 * @return the loaded entities.
128 */
129 public Collection<?> loadAll(final int transform);
130
131 /**
132 * <p>
133 * Does the same thing as {@link #loadAll()} with an
134 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
135 * 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
136 * page retrieved.
137 * </p>
138 *
139 * @param pageNumber the page number to retrieve when paging results.
140 * @param pageSize the size of the page to retrieve when paging results.
141 * @return the loaded entities.
142 */
143 public Collection<?> loadAll(final int pageNumber, final int pageSize);
144
145 /**
146 * <p>
147 * Does the same thing as {@link #loadAll(int)} with an
148 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
149 * 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
150 * page retrieved.
151 * </p>
152 *
153 * @param transform the flag indicating what transformation to use.
154 * @param pageNumber the page number to retrieve when paging results.
155 * @param pageSize the size of the page to retrieve when paging results.
156 * @return the loaded entities.
157 */
158 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
159
160 /**
161 * Creates an instance of FieldObservation and adds it to the persistent store.
162 * @param fieldObservation
163 * @return FieldObservation
164 */
165 public FieldObservation create(FieldObservation fieldObservation);
166
167 /**
168 * <p>
169 * Does the same thing as {@link #create(FieldObservation)} with an
170 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
171 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
172 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
173 * transform the entity (into a value object for example). By default, transformation does
174 * not occur.
175 * </p>
176 * @param transform
177 * @param fieldObservation
178 * @return Object
179 */
180 public Object create(int transform, FieldObservation fieldObservation);
181
182 /**
183 * Creates a new instance of FieldObservation and adds
184 * from the passed in <code>entities</code> collection
185 *
186 * @param entities the collection of FieldObservation
187 * instances to create.
188 *
189 * @return the created instances.
190 */
191 public Collection<FieldObservation> create(Collection<FieldObservation> entities);
192
193 /**
194 * <p>
195 * Does the same thing as {@link #create(FieldObservation)} with an
196 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
197 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
198 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
199 * transform the entities (into value objects for example). By default, transformation does
200 * not occur.
201 * </p>
202 * @param transform
203 * @param entities
204 * @return Collection
205 */
206 public Collection<?> create(int transform, Collection<FieldObservation> entities);
207
208 /**
209 * <p>
210 * Creates a new <code>FieldObservation</code>
211 * instance from <strong>all</strong> attributes and adds it to
212 * the persistent store.
213 * </p>
214 * @param fieldObservNm Libellé de l'observation terrain.
215 Un résumé succint ou un titre
216 * @param fieldObservCm Texte libre décrivant l'observation effectuée sur le terrain.
217 * @param fieldObservValidDt Date de validation de la donnée
218 * @param fieldObservQualifDt Date de qualification de la données
219 * @param fieldObservQualifCm Commentaire sur la qualification du passage
220 D'une façon générale, il faut vérifier que les données de controle, qualification et validation,
221 dates ou commentaires sont bien du ressort de la classe courante et ne doivent pas être gérées dans
222 une super classe de type métadonnées, et plus particulièrement dans ce cas avec les données
223 géométriques et la norme ISO 19115.
224 * @param updateDt Date de modification de l'objet, mise à jour par le système
225 * @return FieldObservation
226 */
227 public FieldObservation create(
228 String fieldObservNm,
229 String fieldObservCm,
230 Date fieldObservValidDt,
231 Date fieldObservQualifDt,
232 String fieldObservQualifCm,
233 Timestamp updateDt);
234
235 /**
236 * <p>
237 * Does the same thing as {@link #create(String, String, Date, Date, String, Timestamp)} with an
238 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
239 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
240 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
241 * transform the entity (into a value object for example). By default, transformation does
242 * not occur.
243 * </p>
244 * @param transform
245 * @param fieldObservNm Libellé de l'observation terrain.
246 Un résumé succint ou un titre
247 * @param fieldObservCm Texte libre décrivant l'observation effectuée sur le terrain.
248 * @param fieldObservValidDt Date de validation de la donnée
249 * @param fieldObservQualifDt Date de qualification de la données
250 * @param fieldObservQualifCm Commentaire sur la qualification du passage
251 D'une façon générale, il faut vérifier que les données de controle, qualification et validation,
252 dates ou commentaires sont bien du ressort de la classe courante et ne doivent pas être gérées dans
253 une super classe de type métadonnées, et plus particulièrement dans ce cas avec les données
254 géométriques et la norme ISO 19115.
255 * @param updateDt Date de modification de l'objet, mise à jour par le système
256 * @return FieldObservation
257 */
258 public Object create(
259 int transform,
260 String fieldObservNm,
261 String fieldObservCm,
262 Date fieldObservValidDt,
263 Date fieldObservQualifDt,
264 String fieldObservQualifCm,
265 Timestamp updateDt);
266
267 /**
268 * <p>
269 * Creates a new <code>FieldObservation</code>
270 * instance from only <strong>required</strong> properties (attributes
271 * and association ends) and adds it to the persistent store.
272 * </p>
273 * @param updateDt
274 * @param observationTypology
275 * @param qualityFlag
276 * @param recorderDepartment
277 * @param survey
278 * @return FieldObservation
279 */
280 public FieldObservation create(
281 Timestamp updateDt,
282 ObservationTypology observationTypology,
283 QualityFlag qualityFlag,
284 Department recorderDepartment,
285 Survey survey);
286
287 /**
288 * <p>
289 * Does the same thing as {@link #create(Timestamp)} with an
290 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
291 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
292 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
293 * transform the entity (into a value object for example). By default, transformation does
294 * not occur.
295 * </p>
296 * @param transform flag to determine transformation type.
297 * @param updateDt
298 * @param observationTypology
299 * @param qualityFlag
300 * @param recorderDepartment
301 * @param survey
302 * @return Object
303 */
304 public Object create(
305 int transform,
306 Timestamp updateDt,
307 ObservationTypology observationTypology,
308 QualityFlag qualityFlag,
309 Department recorderDepartment,
310 Survey survey);
311
312 /**
313 * Updates the <code>fieldObservation</code> instance in the persistent store.
314 * @param fieldObservation
315 */
316 public void update(FieldObservation fieldObservation);
317
318 /**
319 * Updates all instances in the <code>entities</code> collection in the persistent store.
320 * @param entities
321 */
322 public void update(Collection<FieldObservation> entities);
323
324 /**
325 * Removes the instance of FieldObservation from the persistent store.
326 * @param fieldObservation
327 */
328 public void remove(FieldObservation fieldObservation);
329
330 /**
331 * Removes the instance of FieldObservation having the given
332 * <code>identifier</code> from the persistent store.
333 * @param fieldObservId
334 */
335 public void remove(Integer fieldObservId);
336
337 /**
338 * Removes all entities in the given <code>entities</code> collection.
339 * @param entities
340 */
341 public void remove(Collection<FieldObservation> entities);
342
343
344 /**
345 * Does the same thing as {@link #search(int, Search)} but with an
346 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
347 * limit your data to a specified page number and size.
348 *
349 * @param transform the transformation flag.
350 * @param pageNumber the page number in the data to retrieve
351 * @param pageSize the size of the page to retrieve.
352 * @param search the search object which provides the search parameters and pagination specification.
353 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
354 */
355 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
356
357 /**
358 * Does the same thing as {@link #search(Search)} but with an
359 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
360 * limit your data to a specified page number and size.
361 *
362 * @param pageNumber the page number in the data to retrieve
363 * @param pageSize the size of the page to retrieve.
364 * @param search the search object which provides the search parameters and pagination specification.
365 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
366 */
367 public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
368
369 /**
370 * Does the same thing as {@link #search(Search)} but with an
371 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
372 * finder results will <strong>NOT</strong> be transformed during retrieval.
373 * If this flag is any of the other constants defined here
374 * then results <strong>WILL BE</strong> passed through an operation which can optionally
375 * transform the entities (into value objects for example). By default, transformation does
376 * not occur.
377 *
378 * @param transform the transformation flag.
379 * @param search the search object which provides the search parameters and pagination specification.
380 * @return any found results from the search.
381 */
382 public Set<?> search(final int transform, final Search search);
383
384 /**
385 * Performs a search using the parameters specified in the given <code>search</code> object.
386 *
387 * @param search the search object which provides the search parameters and pagination specification.
388 * @return any found results from the search.
389 */
390 public Set<FieldObservation> search(final Search search);
391
392 /**
393 * Allows transformation of entities into value objects
394 * (or something else for that matter), when the <code>transform</code>
395 * flag is set to one of the constants defined in <code>fr.ifremer.quadrige2.core.dao.data.survey.FieldObservationDao</code>, please note
396 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
397 * will be returned.
398 *
399 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
400 *
401 * @param transform one of the constants declared in {@link fr.ifremer.quadrige2.core.dao.data.survey.FieldObservationDao}
402 * @param entity an entity that was found
403 * @return the transformed entity (i.e. new value object, etc)
404 * @see #transformEntities(int,Collection)
405 */
406 public Object transformEntity(final int transform, final FieldObservation entity);
407
408 /**
409 * Transforms a collection of entities using the
410 * {@link #transformEntity(int,FieldObservation)}
411 * method. This method does not instantiate a new collection.
412 * <p>
413 * This method is to be used internally only.
414 *
415 * @param transform one of the constants declared in <code>fr.ifremer.quadrige2.core.dao.data.survey.FieldObservationDao</code>
416 * @param entities the collection of entities to transform
417 * @see #transformEntity(int,FieldObservation)
418 */
419 public void transformEntities(final int transform, final Collection<?> entities);
420
421 // spring-dao merge-point
422 }