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