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.RulePreconditionVO;
30 import java.sql.Timestamp;
31 import java.util.Collection;
32 import java.util.Set;
33 import org.andromda.spring.PaginationResult;
34
35 /**
36 *
37 * @see RulePrecondition
38 */
39 public interface RulePreconditionDao
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 RulePrecondition}
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 RulePreconditionVO}.
66 */
67 public static final int TRANSFORM_RULEPRECONDITIONVO = 1;
68
69 /**
70 * Copies the fields of the specified entity to the target value object. This method is similar to
71 * toRulePreconditionVO(), 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 toRulePreconditionVO(
77 RulePrecondition source,
78 RulePreconditionVO target);
79
80 /**
81 * Converts this DAO's entity to an object of type {@link RulePreconditionVO}.
82 * @param entity
83 * @return RulePreconditionVO
84 */
85 public RulePreconditionVO toRulePreconditionVO(RulePrecondition entity);
86
87 /**
88 * Converts this DAO's entity to a Collection of instances of type {@link RulePreconditionVO}.
89 * @param entities
90 */
91 public Collection<RulePreconditionVO> toRulePreconditionVOCollection(Collection<?> entities);
92
93 /**
94 * Converts this DAO's entity to an array of instances of type {@link RulePreconditionVO}.
95 * @param entities
96 * @return RulePreconditionVO[]
97 */
98 public RulePreconditionVO[] toRulePreconditionVOArray(Collection<?> entities);
99
100 /**
101 * Copies the fields of {@link RulePreconditionVO} 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 rulePreconditionVOToEntity(
108 RulePreconditionVO source,
109 RulePrecondition target,
110 boolean copyIfNull);
111
112 /**
113 * Converts an instance of type {@link RulePreconditionVO} to this DAO's entity.
114 * @param rulePreconditionVO
115 * @return RulePrecondition
116 */
117 public RulePrecondition rulePreconditionVOToEntity(RulePreconditionVO rulePreconditionVO);
118
119 /**
120 * Converts a Collection of instances of type {@link RulePreconditionVO} to this
121 * DAO's entity.
122 * @param instances
123 */
124 public void rulePreconditionVOToEntityCollection(Collection<?> instances);
125
126 /**
127 * Gets an instance of RulePrecondition from the persistent store.
128 * @param rulePrecondId
129 * @return RulePrecondition
130 */
131 public RulePrecondition get(Integer rulePrecondId);
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 rulePrecondId 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 rulePrecondId);
148
149 /**
150 * Loads an instance of RulePrecondition from the persistent store.
151 * @param rulePrecondId
152 * @return RulePrecondition
153 */
154 public RulePrecondition load(Integer rulePrecondId);
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 rulePrecondId 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 rulePrecondId);
171
172 /**
173 * Loads all entities of type {@link RulePrecondition}.
174 *
175 * @return the loaded entities.
176 */
177 public Collection<RulePrecondition> 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 RulePrecondition and adds it to the persistent store.
225 * @param rulePrecondition
226 * @return RulePrecondition
227 */
228 public RulePrecondition create(RulePrecondition rulePrecondition);
229
230 /**
231 * <p>
232 * Does the same thing as {@link #create(RulePrecondition)} 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 rulePrecondition
241 * @return Object
242 */
243 public Object create(int transform, RulePrecondition rulePrecondition);
244
245 /**
246 * Creates a new instance of RulePrecondition and adds
247 * from the passed in <code>entities</code> collection
248 *
249 * @param entities the collection of RulePrecondition
250 * instances to create.
251 *
252 * @return the created instances.
253 */
254 public Collection<RulePrecondition> create(Collection<RulePrecondition> entities);
255
256 /**
257 * <p>
258 * Does the same thing as {@link #create(RulePrecondition)} 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<RulePrecondition> entities);
270
271 /**
272 * <p>
273 * Creates a new <code>RulePrecondition</code>
274 * instance from <strong>all</strong> attributes and adds it to
275 * the persistent store.
276 * </p>
277 * @param rulePrecondLb
278 * @param rulePrecondIsBidir
279 * @param rulePrecondIsActive
280 * @param updateDt
281 * @return RulePrecondition
282 */
283 public RulePrecondition create(
284 String rulePrecondLb,
285 String rulePrecondIsBidir,
286 String rulePrecondIsActive,
287 Timestamp updateDt);
288
289 /**
290 * <p>
291 * Does the same thing as {@link #create(String, String, String, Timestamp)} with an
292 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
293 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
294 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
295 * transform the entity (into a value object for example). By default, transformation does
296 * not occur.
297 * </p>
298 * @param transform
299 * @param rulePrecondLb
300 * @param rulePrecondIsBidir
301 * @param rulePrecondIsActive
302 * @param updateDt
303 * @return RulePrecondition
304 */
305 public Object create(
306 int transform,
307 String rulePrecondLb,
308 String rulePrecondIsBidir,
309 String rulePrecondIsActive,
310 Timestamp updateDt);
311
312 /**
313 * <p>
314 * Creates a new <code>RulePrecondition</code>
315 * instance from only <strong>required</strong> properties (attributes
316 * and association ends) and adds it to the persistent store.
317 * </p>
318 * @param rule
319 * @param rulePrecondIsActive
320 * @param rulePrecondIsBidir
321 * @param rulePrecondLb
322 * @param usedRule
323 * @return RulePrecondition
324 */
325 public RulePrecondition create(
326 Rule rule,
327 String rulePrecondIsActive,
328 String rulePrecondIsBidir,
329 String rulePrecondLb,
330 Rule usedRule);
331
332 /**
333 * <p>
334 * Does the same thing as {@link #create(String, String, String)} with an
335 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
336 * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants
337 * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally
338 * transform the entity (into a value object for example). By default, transformation does
339 * not occur.
340 * </p>
341 * @param transform flag to determine transformation type.
342 * @param rule
343 * @param rulePrecondIsActive
344 * @param rulePrecondIsBidir
345 * @param rulePrecondLb
346 * @param usedRule
347 * @return Object
348 */
349 public Object create(
350 int transform,
351 Rule rule,
352 String rulePrecondIsActive,
353 String rulePrecondIsBidir,
354 String rulePrecondLb,
355 Rule usedRule);
356
357 /**
358 * Updates the <code>rulePrecondition</code> instance in the persistent store.
359 * @param rulePrecondition
360 */
361 public void update(RulePrecondition rulePrecondition);
362
363 /**
364 * Updates all instances in the <code>entities</code> collection in the persistent store.
365 * @param entities
366 */
367 public void update(Collection<RulePrecondition> entities);
368
369 /**
370 * Removes the instance of RulePrecondition from the persistent store.
371 * @param rulePrecondition
372 */
373 public void remove(RulePrecondition rulePrecondition);
374
375 /**
376 * Removes the instance of RulePrecondition having the given
377 * <code>identifier</code> from the persistent store.
378 * @param rulePrecondId
379 */
380 public void remove(Integer rulePrecondId);
381
382 /**
383 * Removes all entities in the given <code>entities</code> collection.
384 * @param entities
385 */
386 public void remove(Collection<RulePrecondition> entities);
387
388 /**
389 *
390 * @param rulePrecondition
391 * @param updateDt
392 * @return RulePreconditionVO
393 */
394 public RulePreconditionVO save(RulePreconditionVO rulePrecondition, Timestamp updateDt);
395
396 /**
397 *
398 * @param rulePreconditionIds
399 * @return void
400 */
401 public void removeByIds(Collection<Integer> rulePreconditionIds);
402
403
404 /**
405 * Does the same thing as {@link #search(int, Search)} but with an
406 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
407 * limit your data to a specified page number and size.
408 *
409 * @param transform the transformation flag.
410 * @param pageNumber the page number in the data to retrieve
411 * @param pageSize the size of the page to retrieve.
412 * @param search the search object which provides the search parameters and pagination specification.
413 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
414 */
415 public PaginationResult search(final int transform, final int pageNumber, final int pageSize, final Search search);
416
417 /**
418 * Does the same thing as {@link #search(Search)} but with an
419 * additional two flags called <code>pageNumber</code> and <code>pageSize</code>. These flags allow you to
420 * limit your data to a specified page number and size.
421 *
422 * @param pageNumber the page number in the data to retrieve
423 * @param pageSize the size of the page to retrieve.
424 * @param search the search object which provides the search parameters and pagination specification.
425 * @return any found results from the search wrapped in a {@link PaginationResult} instance.
426 */
427 public PaginationResult search(final int pageNumber, final int pageSize, final Search search);
428
429 /**
430 * Does the same thing as {@link #search(Search)} but with an
431 * additional flag called <code>transform</code>. If this flag is set to <code>TRANSFORM_NONE</code> then
432 * finder results will <strong>NOT</strong> be transformed during retrieval.
433 * If this flag is any of the other constants defined here
434 * then results <strong>WILL BE</strong> passed through an operation which can optionally
435 * transform the entities (into value objects for example). By default, transformation does
436 * not occur.
437 *
438 * @param transform the transformation flag.
439 * @param search the search object which provides the search parameters and pagination specification.
440 * @return any found results from the search.
441 */
442 public Set<?> search(final int transform, final Search search);
443
444 /**
445 * Performs a search using the parameters specified in the given <code>search</code> object.
446 *
447 * @param search the search object which provides the search parameters and pagination specification.
448 * @return any found results from the search.
449 */
450 public Set<RulePrecondition> search(final Search search);
451
452 /**
453 * Allows transformation of entities into value objects
454 * (or something else for that matter), when the <code>transform</code>
455 * flag is set to one of the constants defined in <code>fr.ifremer.quadrige3.core.dao.system.rule.RulePreconditionDao</code>, please note
456 * that the {@link #TRANSFORM_NONE} constant denotes no transformation, so the entity itself
457 * will be returned.
458 * <p>
459 * This method will return instances of these types:
460 * <ul>
461 * <li>{@link RulePrecondition} - {@link #TRANSFORM_NONE}</li>
462 * <li>{@link RulePreconditionVO} - {@link #TRANSFORM_RULEPRECONDITIONVO}</li>
463 * </ul>
464 *
465 * If the integer argument value is unknown {@link #TRANSFORM_NONE} is assumed.
466 *
467 * @param transform one of the constants declared in {@link fr.ifremer.quadrige3.core.dao.system.rule.RulePreconditionDao}
468 * @param entity an entity that was found
469 * @return the transformed entity (i.e. new value object, etc)
470 * @see #transformEntities(int,Collection)
471 */
472 public Object transformEntity(final int transform, final RulePrecondition entity);
473
474 /**
475 * Transforms a collection of entities using the
476 * {@link #transformEntity(int,RulePrecondition)}
477 * method. This method does not instantiate a new collection.
478 * <p>
479 * This method is to be used internally only.
480 *
481 * @param transform one of the constants declared in <code>fr.ifremer.quadrige3.core.dao.system.rule.RulePreconditionDao</code>
482 * @param entities the collection of entities to transform
483 * @see #transformEntity(int,RulePrecondition)
484 */
485 public void transformEntities(final int transform, final Collection<?> entities);
486
487 // spring-dao merge-point
488 }