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