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