1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-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 java.io.Serializable;
30 import java.sql.Timestamp;
31 import java.util.Collection;
32 import java.util.HashSet;
33
34 /**
35 * Cette table permet de conserver les règles de contrôle
36 */
37 // HibernateEntity.vsl annotations merge-point
38 public abstract class Rule
39 implements Serializable, Comparable<Rule>
40 {
41 /**
42 * The serial version UID of this class. Needed for serialization.
43 */
44 private static final long serialVersionUID = 4559848545964014818L;
45
46 // Generate 7 attributes
47 private String ruleCd;
48
49 /**
50 * Code de la règle de contrôle
51 * @return this.ruleCd String
52 */
53 public String getRuleCd()
54 {
55 return this.ruleCd;
56 }
57
58 /**
59 * Code de la règle de contrôle
60 * @param ruleCdIn String
61 */
62 public void setRuleCd(String ruleCdIn)
63 {
64 this.ruleCd = ruleCdIn;
65 }
66
67 private String ruleControledAttribut;
68
69 /**
70 * Attribut de l'élément contrôlé
71 * @return this.ruleControledAttribut String
72 */
73 public String getRuleControledAttribut()
74 {
75 return this.ruleControledAttribut;
76 }
77
78 /**
79 * Attribut de l'élément contrôlé
80 * @param ruleControledAttributIn String
81 */
82 public void setRuleControledAttribut(String ruleControledAttributIn)
83 {
84 this.ruleControledAttribut = ruleControledAttributIn;
85 }
86
87 private String ruleDc;
88
89 /**
90 * Description de la règle
91 * @return this.ruleDc String
92 */
93 public String getRuleDc()
94 {
95 return this.ruleDc;
96 }
97
98 /**
99 * Description de la règle
100 * @param ruleDcIn String
101 */
102 public void setRuleDc(String ruleDcIn)
103 {
104 this.ruleDc = ruleDcIn;
105 }
106
107 private String ruleIsActive;
108
109 /**
110 * Indique si la règle est active ou non
111 * @return this.ruleIsActive String
112 */
113 public String getRuleIsActive()
114 {
115 return this.ruleIsActive;
116 }
117
118 /**
119 * Indique si la règle est active ou non
120 * @param ruleIsActiveIn String
121 */
122 public void setRuleIsActive(String ruleIsActiveIn)
123 {
124 this.ruleIsActive = ruleIsActiveIn;
125 }
126
127 private String ruleIsBlocking;
128
129 /**
130 * Indique si le non respect de la règle est bloquant ou non
131 * @return this.ruleIsBlocking String
132 */
133 public String getRuleIsBlocking()
134 {
135 return this.ruleIsBlocking;
136 }
137
138 /**
139 * Indique si le non respect de la règle est bloquant ou non
140 * @param ruleIsBlockingIn String
141 */
142 public void setRuleIsBlocking(String ruleIsBlockingIn)
143 {
144 this.ruleIsBlocking = ruleIsBlockingIn;
145 }
146
147 private String ruleErrorMsg;
148
149 /**
150 * Message d'erreur renvoyé si la règle n'est pas respectée
151 * @return this.ruleErrorMsg String
152 */
153 public String getRuleErrorMsg()
154 {
155 return this.ruleErrorMsg;
156 }
157
158 /**
159 * Message d'erreur renvoyé si la règle n'est pas respectée
160 * @param ruleErrorMsgIn String
161 */
162 public void setRuleErrorMsg(String ruleErrorMsgIn)
163 {
164 this.ruleErrorMsg = ruleErrorMsgIn;
165 }
166
167 private Timestamp updateDt;
168
169 /**
170 * Date de modification de l'objet, mise à jour par le système
171 * @return this.updateDt Timestamp
172 */
173 public Timestamp getUpdateDt()
174 {
175 return this.updateDt;
176 }
177
178 /**
179 * Date de modification de l'objet, mise à jour par le système
180 * @param updateDtIn Timestamp
181 */
182 public void setUpdateDt(Timestamp updateDtIn)
183 {
184 this.updateDt = updateDtIn;
185 }
186
187 // Generate 6 associations
188 private RuleList ruleList;
189
190 /**
191 * Cette table permet de conserver les listes de règles de contrôle
192 * @return this.ruleList RuleList
193 */
194 public RuleList getRuleList()
195 {
196 return this.ruleList;
197 }
198
199 /**
200 * Cette table permet de conserver les listes de règles de contrôle
201 * @param ruleListIn RuleList
202 */
203 public void setRuleList(RuleList ruleListIn)
204 {
205 this.ruleList = ruleListIn;
206 }
207
208 private Collection<RuleParameter> ruleParameters = new HashSet<RuleParameter>();
209
210 /**
211 * Cette table permet de conserver les paramètres des règles de contrôle
212 * @return this.ruleParameters Collection<RuleParameter>
213 */
214 public Collection<RuleParameter> getRuleParameters()
215 {
216 return this.ruleParameters;
217 }
218
219 /**
220 * Cette table permet de conserver les paramètres des règles de contrôle
221 * @param ruleParametersIn Collection<RuleParameter>
222 */
223 public void setRuleParameters(Collection<RuleParameter> ruleParametersIn)
224 {
225 this.ruleParameters = ruleParametersIn;
226 }
227
228 /**
229 * Cette table permet de conserver les paramètres des règles de contrôle
230 * @param elementToAdd RuleParameter
231 * @return <tt>true</tt> if this collection changed as a result of the
232 * call
233 */
234 public boolean addRuleParameters(RuleParameter elementToAdd)
235 {
236 return this.ruleParameters.add(elementToAdd);
237 }
238
239 /**
240 * Cette table permet de conserver les paramètres des règles de contrôle
241 * @param elementToRemove RuleParameter
242 * @return <tt>true</tt> if this collection changed as a result of the
243 * call
244 */
245 public boolean removeRuleParameters(RuleParameter elementToRemove)
246 {
247 return this.ruleParameters.remove(elementToRemove);
248 }
249
250 private Function function;
251
252 /**
253 * Cette table permet de conserver les fonctions de contrôle
254 * @return this.function Function
255 */
256 public Function getFunction()
257 {
258 return this.function;
259 }
260
261 /**
262 * Cette table permet de conserver les fonctions de contrôle
263 * @param functionIn Function
264 */
265 public void setFunction(Function functionIn)
266 {
267 this.function = functionIn;
268 }
269
270 private Collection<RulePmfm> rulePmfms = new HashSet<RulePmfm>();
271
272 /**
273 * Cette table permet de conserver les PMFM concernés par une règle de contrôle
274 * @return this.rulePmfms Collection<RulePmfm>
275 */
276 public Collection<RulePmfm> getRulePmfms()
277 {
278 return this.rulePmfms;
279 }
280
281 /**
282 * Cette table permet de conserver les PMFM concernés par une règle de contrôle
283 * @param rulePmfmsIn Collection<RulePmfm>
284 */
285 public void setRulePmfms(Collection<RulePmfm> rulePmfmsIn)
286 {
287 this.rulePmfms = rulePmfmsIn;
288 }
289
290 /**
291 * Cette table permet de conserver les PMFM concernés par une règle de contrôle
292 * @param elementToAdd RulePmfm
293 * @return <tt>true</tt> if this collection changed as a result of the
294 * call
295 */
296 public boolean addRulePmfms(RulePmfm elementToAdd)
297 {
298 return this.rulePmfms.add(elementToAdd);
299 }
300
301 /**
302 * Cette table permet de conserver les PMFM concernés par une règle de contrôle
303 * @param elementToRemove RulePmfm
304 * @return <tt>true</tt> if this collection changed as a result of the
305 * call
306 */
307 public boolean removeRulePmfms(RulePmfm elementToRemove)
308 {
309 return this.rulePmfms.remove(elementToRemove);
310 }
311
312 private Collection<RulePrecondition> rulePreconditions = new HashSet<RulePrecondition>();
313
314 /**
315 *
316 * @return this.rulePreconditions Collection<RulePrecondition>
317 */
318 public Collection<RulePrecondition> getRulePreconditions()
319 {
320 return this.rulePreconditions;
321 }
322
323 /**
324 *
325 * @param rulePreconditionsIn Collection<RulePrecondition>
326 */
327 public void setRulePreconditions(Collection<RulePrecondition> rulePreconditionsIn)
328 {
329 this.rulePreconditions = rulePreconditionsIn;
330 }
331
332 /**
333 *
334 * @param elementToAdd RulePrecondition
335 * @return <tt>true</tt> if this collection changed as a result of the
336 * call
337 */
338 public boolean addRulePreconditions(RulePrecondition elementToAdd)
339 {
340 return this.rulePreconditions.add(elementToAdd);
341 }
342
343 /**
344 *
345 * @param elementToRemove RulePrecondition
346 * @return <tt>true</tt> if this collection changed as a result of the
347 * call
348 */
349 public boolean removeRulePreconditions(RulePrecondition elementToRemove)
350 {
351 return this.rulePreconditions.remove(elementToRemove);
352 }
353
354 /**
355 * Returns <code>true</code> if the argument is an Rule instance and all identifiers for this entity
356 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
357 */
358 @Override
359 public boolean equals(Object object)
360 {
361 if (this == object)
362 {
363 return true;
364 }
365 if (!(object instanceof Rule))
366 {
367 return false;
368 }
369 final Rule that = (Rule)object;
370 if (this.ruleCd == null || that.getRuleCd() == null || !this.ruleCd.equals(that.getRuleCd()))
371 {
372 return false;
373 }
374 return true;
375 }
376
377 /**
378 * Returns a hash code based on this entity's identifiers.
379 */
380 @Override
381 public int hashCode()
382 {
383 int hashCode = 0;
384 hashCode = 29 * hashCode + (this.ruleCd == null ? 0 : this.ruleCd.hashCode());
385
386 return hashCode;
387 }
388
389 /**
390 * Constructs new instances of {@link Rule}.
391 */
392 public static final class Factory
393 {
394 /**
395 * Constructs a new instance of {@link Rule}.
396 * @return new RuleImpl()
397 */
398 public static Rule newInstance()
399 {
400 return new RuleImpl();
401 }
402
403 /**
404 * Constructs a new instance of {@link Rule}, taking all required and/or
405 * read-only properties as arguments, except for identifiers.
406 * @param ruleControledAttribut String
407 * @param updateDt Timestamp
408 * @param function Function
409 * @return newInstance
410 */
411 public static Rule newInstance(String ruleControledAttribut, Timestamp updateDt, Function function)
412 {
413 final Rule entity = new RuleImpl();
414 entity.setRuleControledAttribut(ruleControledAttribut);
415 entity.setUpdateDt(updateDt);
416 entity.setFunction(function);
417 return entity;
418 }
419
420 /**
421 * Constructs a new instance of {@link Rule}, taking all possible properties
422 * (except the identifier(s))as arguments.
423 * @param ruleControledAttribut String
424 * @param ruleDc String
425 * @param ruleIsActive String
426 * @param ruleIsBlocking String
427 * @param ruleErrorMsg String
428 * @param updateDt Timestamp
429 * @param ruleList RuleList
430 * @param ruleParameters Collection<RuleParameter>
431 * @param function Function
432 * @param rulePmfms Collection<RulePmfm>
433 * @param rulePreconditions Collection<RulePrecondition>
434 * @return newInstance Rule
435 */
436 public static Rule newInstance(String ruleControledAttribut, String ruleDc, String ruleIsActive, String ruleIsBlocking, String ruleErrorMsg, Timestamp updateDt, RuleList ruleList, Collection<RuleParameter> ruleParameters, Function function, Collection<RulePmfm> rulePmfms, Collection<RulePrecondition> rulePreconditions)
437 {
438 final Rule entity = new RuleImpl();
439 entity.setRuleControledAttribut(ruleControledAttribut);
440 entity.setRuleDc(ruleDc);
441 entity.setRuleIsActive(ruleIsActive);
442 entity.setRuleIsBlocking(ruleIsBlocking);
443 entity.setRuleErrorMsg(ruleErrorMsg);
444 entity.setUpdateDt(updateDt);
445 entity.setRuleList(ruleList);
446 entity.setRuleParameters(ruleParameters);
447 entity.setFunction(function);
448 entity.setRulePmfms(rulePmfms);
449 entity.setRulePreconditions(rulePreconditions);
450 return entity;
451 }
452 }
453
454 /**
455 * @see Comparable#compareTo
456 */
457 public int compareTo(Rule o)
458 {
459 int cmp = 0;
460 if (this.getRuleCd() != null)
461 {
462 cmp = this.getRuleCd().compareTo(o.getRuleCd());
463 }
464 else
465 {
466 if (this.getRuleControledAttribut() != null)
467 {
468 cmp = (cmp != 0 ? cmp : this.getRuleControledAttribut().compareTo(o.getRuleControledAttribut()));
469 }
470 if (this.getRuleDc() != null)
471 {
472 cmp = (cmp != 0 ? cmp : this.getRuleDc().compareTo(o.getRuleDc()));
473 }
474 if (this.getRuleIsActive() != null)
475 {
476 cmp = (cmp != 0 ? cmp : this.getRuleIsActive().compareTo(o.getRuleIsActive()));
477 }
478 if (this.getRuleIsBlocking() != null)
479 {
480 cmp = (cmp != 0 ? cmp : this.getRuleIsBlocking().compareTo(o.getRuleIsBlocking()));
481 }
482 if (this.getRuleErrorMsg() != null)
483 {
484 cmp = (cmp != 0 ? cmp : this.getRuleErrorMsg().compareTo(o.getRuleErrorMsg()));
485 }
486 if (this.getUpdateDt() != null)
487 {
488 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
489 }
490 }
491 return cmp;
492 }
493 // HibernateEntity.vsl merge-point
494 // Rule.java merge-point
495 }