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.rule;
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 fr.ifremer.quadrige3.core.vo.system.rule.RuleParameterVO;
30 import java.sql.Timestamp;
31 import java.util.Collection;
32 import java.util.Set;
33 import org.andromda.spring.PaginationResult;
34
35 /**
36 * Cette table permet de conserver les paramètres des règles de contrôle
37 * @see RuleParameter
38 */
39 public interface RuleParameterDao
40 {
41 /**
42 * This constant is used as a transformation flag; entities can be converted automatically into value objects
43 * or other types, different methods in a class implementing this interface support this feature: look for
44 * an <code>int</code> parameter called <code>transform</code>.
45 * <p>
46 * This specific flag denotes no transformation will occur.
47 */
48 public static final int TRANSFORM_NONE = 0;
49
50
51 /**
52 * Transforms the given results to a collection of {@link RuleParameter}
53 * instances (this is useful when the returned results contains a row of data and you want just entities only).
54 *
55 * @param results the query results.
56 */
57 public void toEntities(final Collection<?> results);
58
59 /**
60 * This constant is used as a transformation flag; entities can be converted automatically into value objects
61 * or other types, different methods in a class implementing this interface support this feature: look for
62 * an <code>int</code> parameter called <code>transform</code>.
63 * <p>
64 * This specific flag denotes entities must be transformed into objects of type
65 * {@link RuleParameterVO}.
66 */
67 public static final int TRANSFORM_RULEPARAMETERVO = 1;
68
69 /**
70 * Copies the fields of the specified entity to the target value object. This method is similar to
71 * toRuleParameterVO(), but it does not handle any attributes in the target
72 * value object that are "read-only" (as those do not have setter methods exposed).
73 * @param source
74 * @param target
75 */
76 public void toRuleParameterVO(
77 RuleParameter source,
78 RuleParameterVO target);
79
80 /**
81 * Converts this DAO's entity to an object of type {@link RuleParameterVO}.
82 * @param entity
83 * @return RuleParameterVO
84 */
85 public RuleParameterVO toRuleParameterVO(RuleParameter entity);
86
87 /**
88 * Converts this DAO's entity to a Collection of instances of type {@link RuleParameterVO}.
89 * @param entities
90 */
91 public Collection<RuleParameterVO> toRuleParameterVOCollection(Collection<?> entities);
92
93 /**
94 * Converts this DAO's entity to an array of instances of type {@link RuleParameterVO}.
95 * @param entities
96 * @return RuleParameterVO[]
97 */
98 public RuleParameterVO[] toRuleParameterVOArray(Collection<?> entities);
99
100 /**
101 * Copies the fields of {@link RuleParameterVO} to the specified entity.
102 * @param source
103 * @param target
104 * @param copyIfNull If FALSE, the value object's field will not be copied to the entity if the value is NULL. If TRUE,
105 * it will be copied regardless of its value.
106 */
107 public void ruleParameterVOToEntity(
108 RuleParameterVO source,
109 RuleParameter target,
110 boolean copyIfNull);
111
112 /**
113 * Converts an instance of type {@link RuleParameterVO} to this DAO's entity.
114 * @param ruleParameterVO
115 * @return RuleParameter
116 */
117 public RuleParameter ruleParameterVOToEntity(RuleParameterVO ruleParameterVO);
118
119 /**
120 * Converts a Collection of instances of type {@link RuleParameterVO} to this
121 * DAO's entity.
122 * @param instances
123 */
124 public void ruleParameterVOToEntityCollection(Collection<?> instances);
125
126 /**
127 * Gets an instance of RuleParameter from the persistent store.
128 * @param ruleParId
129 * @return RuleParameter
130 */
131 public RuleParameter get(Integer ruleParId);
132
133 /**
134 * <p>
135 * Does the same thing as {@link #get(Integer)} with an
136 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
137 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
138 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
139 * optionally transform the entity (into a value object for example). By default, transformation does
140 * not occur.
141 * </p>
142 *
143 * @param transform flag to determine transformation type.
144 * @param ruleParId the identifier of the entity to get.
145 * @return either the entity or the object transformed from the entity.
146 */
147 public Object get(int transform, Integer ruleParId);
148
149 /**
150 * Loads an instance of RuleParameter from the persistent store.
151 * @param ruleParId
152 * @return RuleParameter
153 */
154 public RuleParameter load(Integer ruleParId);
155
156 /**
157 * <p>
158 * Does the same thing as {@link #load(Integer)} with an
159 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
160 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
161 * defined in this class then the result <strong>WILL BE</strong> passed through an operation which can
162 * optionally transform the entity (into a value object for example). By default, transformation does
163 * not occur.
164 * </p>
165 *
166 * @param transform flag to determine transformation type.
167 * @param ruleParId the identifier of the entity to load.
168 * @return either the entity or the object transformed from the entity.
169 */
170 public Object load(int transform, Integer ruleParId);
171
172 /**
173 * Loads all entities of type {@link RuleParameter}.
174 *
175 * @return the loaded entities.
176 */
177 public Collection<RuleParameter> loadAll();
178
179 /**
180 * <p>
181 * Does the same thing as {@link #loadAll()} with an
182 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
183 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
184 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
185 * transform the entity (into a value object for example). By default, transformation does
186 * not occur.
187 * </p>
188 *
189 * @param transform the flag indicating what transformation to use.
190 * @return the loaded entities.
191 */
192 public Collection<?> loadAll(final int transform);
193
194 /**
195 * <p>
196 * Does the same thing as {@link #loadAll()} with an
197 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
198 * 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
199 * page retrieved.
200 * </p>
201 *
202 * @param pageNumber the page number to retrieve when paging results.
203 * @param pageSize the size of the page to retrieve when paging results.
204 * @return the loaded entities.
205 */
206 public Collection<?> loadAll(final int pageNumber, final int pageSize);
207
208 /**
209 * <p>
210 * Does the same thing as {@link #loadAll(int)} with an
211 * additional two arguments called <code>pageNumber</code> and <code>pageSize</code>. The <code>pageNumber</code>
212 * 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
213 * page retrieved.
214 * </p>
215 *
216 * @param transform the flag indicating what transformation to use.
217 * @param pageNumber the page number to retrieve when paging results.
218 * @param pageSize the size of the page to retrieve when paging results.
219 * @return the loaded entities.
220 */
221 public Collection<?> loadAll(final int transform, final int pageNumber, final int pageSize);
222
223 /**
224 * Creates an instance of RuleParameter and adds it to the persistent store.
225 * @param ruleParameter
226 * @return RuleParameter
227 */
228 public RuleParameter create(RuleParameter ruleParameter);
229
230 /**
231 * <p>
232 * Does the same thing as {@link #create(RuleParameter)} with an
233 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
234 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
235 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
236 * transform the entity (into a value object for example). By default, transformation does
237 * not occur.
238 * </p>
239 * @param transform
240 * @param ruleParameter
241 * @return Object
242 */
243 public Object create(int transform, RuleParameter ruleParameter);
244
245 /**
246 * Creates a new instance of RuleParameter and adds
247 * from the passed in <code>entities</code> collection
248 *
249 * @param entities the collection of RuleParameter
250 * instances to create.
251 *
252 * @return the created instances.
253 */
254 public Collection<RuleParameter> create(Collection<RuleParameter> entities);
255
256 /**
257 * <p>
258 * Does the same thing as {@link #create(RuleParameter)} with an
259 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
260 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
261 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
262 * transform the entities (into value objects for example). By default, transformation does
263 * not occur.
264 * </p>
265 * @param transform
266 * @param entities
267 * @return Collection
268 */
269 public Collection<?> create(int transform, Collection<RuleParameter> entities);
270
271 /**
272 * <p>
273 * Creates a new <code>RuleParameter</code>
274 * instance from <strong>all</strong> attributes and adds it to
275 * the persistent store.
276 * </p>
277 * @param ruleParValue Valeur du paramètre de la fonction
278 * @param updateDt Date de modification de l'objet, mise à jour par le système
279 * @return RuleParameter
280 */
281 public RuleParameter create(
282 String ruleParValue,
283 Timestamp updateDt);
284
285 /**
286 * <p>
287 * Does the same thing as {@link #create(String, Timestamp)} with an
288 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
289 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
290 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
291 * transform the entity (into a value object for example). By default, transformation does
292 * not occur.
293 * </p>
294 * @param transform
295 * @param ruleParValue Valeur du paramètre de la fonction
296 * @param updateDt Date de modification de l'objet, mise à jour par le système
297 * @return RuleParameter
298 */
299 public Object create(
300 int transform,
301 String ruleParValue,
302 Timestamp updateDt);
303
304 /**
305 * <p>
306 * Creates a new <code>RuleParameter</code>
307 * instance from only <strong>required</strong> properties (attributes
308 * and association ends) and adds it to the persistent store.
309 * </p>
310 * @param ruleParValue
311 * @param functionParameter
312 * @param rule
313 * @return RuleParameter
314 */
315 public RuleParameter create(
316 String ruleParValue,
317 FunctionParameter functionParameter,
318 Rule rule);
319
320 /**
321 * <p>
322 * Does the same thing as {@link #create(String)} with an
323 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
324 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
325 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
326 * transform the entity (into a value object for example). By default, transformation does
327 * not occur.
328 * </p>
329 * @param transform flag to determine transformation type.
330 * @param ruleParValue
331 * @param functionParameter
332 * @param rule
333 * @return Object
334 */
335 public Object create(
336 int transform,
337 String ruleParValue,
338 FunctionParameter functionParameter,
339 Rule rule);
340
341 /**
342 * Updates the <code>ruleParameter</code> instance in the persistent store.
343 * @param ruleParameter
344 */
345 public void update(RuleParameter ruleParameter);
346
347 /**
348 * Updates all instances in the <code>entities</code> collection in the persistent store.
349 * @param entities
350 */
351 public void update(Collection<RuleParameter> entities);
352
353 /**
354 * Removes the instance of RuleParameter from the persistent store.
355 * @param ruleParameter
356 */
357 public void remove(RuleParameter ruleParameter);
358
359 /**
360 * Removes the instance of RuleParameter having the given
361 * <code>identifier</code> from the persistent store.
362 * @param ruleParId
363 */
364 public void remove(Integer ruleParId);
365
366 /**
367 * Removes all entities in the given <code>entities</code> collection.
368 * @param entities
369 */
370 public void remove(Collection<RuleParameter> entities);
371
372 /**
373 *
374 * @param ruleParameter
375 * @param updateDt
376 * @return RuleParameterVO
377 */
378 public RuleParameterVO save(RuleParameterVO ruleParameter, Timestamp updateDt);
379
380 /**
381 *
382 * @param ruleParIds
383 * @return void
384 */
385 public void removeByIds(Collection<Integer> ruleParIds);
386
387
388 /**
389 * Does the same thing as {@link #search(int, Search)} but with an
390 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
391 * limit your data to a specified page number and size.
392 *
393 * @param transform the transformation flag.
394 * @param pageNumber the page number in the data to retrieve
395 * @param pageSize the size of the page to retrieve.
396 * @param search the search object which provides the search parameters and pagination specification.
397 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
398 */
399 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
400
401 /**
402 * Does the same thing as {@link #search(Search)} but with an
403 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
404 * limit your data to a specified page number and size.
405 *
406 * @param pageNumber the page number in the data to retrieve
407 * @param pageSize the size of the page to retrieve.
408 * @param search the search object which provides the search parameters and pagination specification.
409 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
410 */
411 public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
412
413 /**
414 * Does the same thing as {@link #search(Search)} but with an
415 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
416 * finder results will <strong>NOT</strong> be transformed during retrieval.
417 * If this flag is any of the other constants defined here
418 * then results <strong>WILL BE</strong> passed through an operation which can optionally
419 * transform the entities (into value objects for example). By default, transformation does
420 * not occur.
421 *
422 * @param transform the transformation flag.
423 * @param search the search object which provides the search parameters and pagination specification.
424 * @return any found results from the search.
425 */
426 public Set<?> search(final int transform, final Search search);
427
428 /**
429 * Performs a search using the parameters specified in the given <code>search</code> object.
430 *
431 * @param search the search object which provides the search parameters and pagination specification.
432 * @return any found results from the search.
433 */
434 public Set<RuleParameter> search(final Search search);
435
436 /**
437 * Allows transformation of entities into value objects
438 * (or something else for that matter), when the <code>transform</code>
439 * flag is set to one of the constants defined in <code>fr.ifremer.quadrige3.core.dao.system.rule.RuleParameterDao</code>, please note
440 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
441 * will be returned.
442 * <p>
443 * This method will return instances of these types:
444 * <ul>
445 * <li>{@link RuleParameter} - {@link #TRANSFORM_NONE}</li>
446 * <li>{@link RuleParameterVO} - {@link #TRANSFORM_RULEPARAMETERVO}</li>
447 * </ul>
448 *
449 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
450 *
451 * @param transform one of the constants declared in {@link fr.ifremer.quadrige3.core.dao.system.rule.RuleParameterDao}
452 * @param entity an entity that was found
453 * @return the transformed entity (i.e. new value object, etc)
454 * @see #transformEntities(int,Collection)
455 */
456 public Object transformEntity(final int transform, final RuleParameter entity);
457
458 /**
459 * Transforms a collection of entities using the
460 * {@link #transformEntity(int,RuleParameter)}
461 * method. This method does not instantiate a new collection.
462 * <p>
463 * This method is to be used internally only.
464 *
465 * @param transform one of the constants declared in <code>fr.ifremer.quadrige3.core.dao.system.rule.RuleParameterDao</code>
466 * @param entities the collection of entities to transform
467 * @see #transformEntity(int,RuleParameter)
468 */
469 public void transformEntities(final int transform, final Collection<?> entities);
470
471 // spring-dao merge-point
472 }