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