View Javadoc
1   /*
2     * #%L
3     * Quadrige2 Core
4     * %%
5     * Copyright (C) 2017 Ifremer
6     * %%
7     * This program is free software: you can redistribute it and/or modify
8     * it under the terms of the GNU Affero General Public License as published by
9     * the Free Software Foundation, either version 3 of the License, or
10    * (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    * GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU Affero General Public License
18    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19    * #L%
20    */
21  //
22  /**
23   * @author Generated on 11/16/2017 10:58:24+0100 Do not modify by hand!
24   *
25   * TEMPLATE:     ValueObject.vsl in andromda-java-cartridge.
26   * MODEL CLASS:  Données::fr.ifremer.quadrige2.core::vo::system::rule::RuleVO
27   * STEREOTYPE:   ValueObject
28   */
29  package fr.ifremer.quadrige2.core.vo.system.rule;
30  
31  import java.io.Serializable;
32  import java.sql.Timestamp;
33  import java.util.Arrays;
34  import org.apache.commons.lang3.builder.CompareToBuilder;
35  import org.apache.commons.lang3.builder.EqualsBuilder;
36  import org.apache.commons.lang3.builder.HashCodeBuilder;
37  import org.apache.commons.lang3.builder.ToStringBuilder;
38  
39  /**
40   * TODO: Model Documentation for class RuleVO
41   */
42  public class RuleVO
43      implements Serializable, Comparable<RuleVO>
44  {
45      /** The serial version UID of this class. Needed for serialization. */
46      private static final long serialVersionUID = 9147838804589316449L;
47  
48      // Class attributes
49      /** TODO: Model Documentation for attribute ruleCd */
50      protected String ruleCd;
51      /** TODO: Model Documentation for attribute ruleControledAttribut */
52      protected String ruleControledAttribut;
53      /** TODO: Model Documentation for attribute ruleDc */
54      protected String ruleDc;
55      /** TODO: Model Documentation for attribute ruleIsActive */
56      protected String ruleIsActive;
57      /** TODO: Model Documentation for attribute ruleIsBlocking */
58      protected String ruleIsBlocking;
59      /** TODO: Model Documentation for attribute ruleErrorMsg */
60      protected String ruleErrorMsg;
61      /** TODO: Model Documentation for attribute updateDt */
62      protected Timestamp updateDt;
63      /** TODO: Model Documentation for attribute ruleListCd */
64      protected String ruleListCd;
65      /** TODO: Model Documentation for attribute functionId */
66      protected Integer functionId;
67  
68      // Class associationEnds
69      /** TODO: Model Documentation for attribute ruleParameterVOs */
70      protected RuleParameterVO[] ruleParameterVOs;
71  
72      /** TODO: Model Documentation for attribute ruleListVO */
73      protected RuleListVO ruleListVO;
74  
75      /** TODO: Model Documentation for attribute rulePmfmVOs */
76      protected RulePmfmVO[] rulePmfmVOs;
77  
78      /** Default Constructor with no properties */
79      public RuleVO()
80      {
81          // Documented empty block - avoid compiler warning - no super constructor
82      }
83  
84      /**
85       * Constructor taking only required properties
86       * @param ruleCdIn String
87       * @param ruleControledAttributIn String
88       * @param ruleListCdIn String
89       * @param functionIdIn Integer
90       * @param ruleListVOIn RuleListVO
91       */
92      public RuleVO(final String ruleCdIn, final String ruleControledAttributIn, final String ruleListCdIn, final Integer functionIdIn, final RuleListVO ruleListVOIn)
93      {
94          this.ruleCd = ruleCdIn;
95          this.ruleControledAttribut = ruleControledAttributIn;
96          this.ruleListCd = ruleListCdIn;
97          this.functionId = functionIdIn;
98          this.ruleListVO = ruleListVOIn;
99      }
100 
101     /**
102      * Constructor with all properties
103      * @param ruleCdIn String
104      * @param ruleControledAttributIn String
105      * @param ruleDcIn String
106      * @param ruleIsActiveIn String
107      * @param ruleIsBlockingIn String
108      * @param ruleErrorMsgIn String
109      * @param updateDtIn Timestamp
110      * @param ruleListCdIn String
111      * @param functionIdIn Integer
112      * @param ruleParameterVOsIn RuleParameterVO[]
113      * @param ruleListVOIn RuleListVO
114      * @param rulePmfmVOsIn RulePmfmVO[]
115      */
116     public RuleVO(final String ruleCdIn, final String ruleControledAttributIn, final String ruleDcIn, final String ruleIsActiveIn, final String ruleIsBlockingIn, final String ruleErrorMsgIn, final Timestamp updateDtIn, final String ruleListCdIn, final Integer functionIdIn, final RuleParameterVO[] ruleParameterVOsIn, final RuleListVO ruleListVOIn, final RulePmfmVO[] rulePmfmVOsIn)
117     {
118         this.ruleCd = ruleCdIn;
119         this.ruleControledAttribut = ruleControledAttributIn;
120         this.ruleDc = ruleDcIn;
121         this.ruleIsActive = ruleIsActiveIn;
122         this.ruleIsBlocking = ruleIsBlockingIn;
123         this.ruleErrorMsg = ruleErrorMsgIn;
124         this.updateDt = updateDtIn;
125         this.ruleListCd = ruleListCdIn;
126         this.functionId = functionIdIn;
127         this.ruleParameterVOs = ruleParameterVOsIn;
128         this.ruleListVO = ruleListVOIn;
129         this.rulePmfmVOs = rulePmfmVOsIn;
130     }
131 
132     /**
133      * Copies constructor from other RuleVO
134      *
135      * @param otherBean Cannot be <code>null</code>
136      * @throws NullPointerException if the argument is <code>null</code>
137      */
138     public RuleVO(final RuleVO otherBean)
139     {
140         this.ruleCd = otherBean.getRuleCd();
141         this.ruleControledAttribut = otherBean.getRuleControledAttribut();
142         this.ruleDc = otherBean.getRuleDc();
143         this.ruleIsActive = otherBean.getRuleIsActive();
144         this.ruleIsBlocking = otherBean.getRuleIsBlocking();
145         this.ruleErrorMsg = otherBean.getRuleErrorMsg();
146         this.updateDt = otherBean.getUpdateDt();
147         this.ruleListCd = otherBean.getRuleListCd();
148         this.functionId = otherBean.getFunctionId();
149         this.ruleParameterVOs = otherBean.getRuleParameterVOs();
150         this.ruleListVO = otherBean.getRuleListVO();
151         this.rulePmfmVOs = otherBean.getRulePmfmVOs();
152     }
153 
154     /**
155      * Copies all properties from the argument value object into this value object.
156      * @param otherBean Cannot be <code>null</code>
157      */
158     public void copy(final RuleVO otherBean)
159     {
160         if (null != otherBean)
161         {
162             this.setRuleCd(otherBean.getRuleCd());
163             this.setRuleControledAttribut(otherBean.getRuleControledAttribut());
164             this.setRuleDc(otherBean.getRuleDc());
165             this.setRuleIsActive(otherBean.getRuleIsActive());
166             this.setRuleIsBlocking(otherBean.getRuleIsBlocking());
167             this.setRuleErrorMsg(otherBean.getRuleErrorMsg());
168             this.setUpdateDt(otherBean.getUpdateDt());
169             this.setRuleListCd(otherBean.getRuleListCd());
170             this.setFunctionId(otherBean.getFunctionId());
171             this.setRuleParameterVOs(otherBean.getRuleParameterVOs());
172             this.setRuleListVO(otherBean.getRuleListVO());
173             this.setRulePmfmVOs(otherBean.getRulePmfmVOs());
174         }
175     }
176 
177     /**
178      * TODO: Model Documentation for attribute ruleCd
179      * Get the ruleCd Attribute
180      * @return ruleCd String
181      */
182     public String getRuleCd()
183     {
184         return this.ruleCd;
185     }
186 
187     /**
188      * 
189      * @param value String
190      */
191     public void setRuleCd(final String value)
192     {
193         this.ruleCd = value;
194     }
195 
196     /**
197      * TODO: Model Documentation for attribute ruleControledAttribut
198      * Get the ruleControledAttribut Attribute
199      * @return ruleControledAttribut String
200      */
201     public String getRuleControledAttribut()
202     {
203         return this.ruleControledAttribut;
204     }
205 
206     /**
207      * 
208      * @param value String
209      */
210     public void setRuleControledAttribut(final String value)
211     {
212         this.ruleControledAttribut = value;
213     }
214 
215     /**
216      * TODO: Model Documentation for attribute ruleDc
217      * Get the ruleDc Attribute
218      * @return ruleDc String
219      */
220     public String getRuleDc()
221     {
222         return this.ruleDc;
223     }
224 
225     /**
226      * 
227      * @param value String
228      */
229     public void setRuleDc(final String value)
230     {
231         this.ruleDc = value;
232     }
233 
234     /**
235      * TODO: Model Documentation for attribute ruleIsActive
236      * Get the ruleIsActive Attribute
237      * @return ruleIsActive String
238      */
239     public String getRuleIsActive()
240     {
241         return this.ruleIsActive;
242     }
243 
244     /**
245      * 
246      * @param value String
247      */
248     public void setRuleIsActive(final String value)
249     {
250         this.ruleIsActive = value;
251     }
252 
253     /**
254      * TODO: Model Documentation for attribute ruleIsBlocking
255      * Get the ruleIsBlocking Attribute
256      * @return ruleIsBlocking String
257      */
258     public String getRuleIsBlocking()
259     {
260         return this.ruleIsBlocking;
261     }
262 
263     /**
264      * 
265      * @param value String
266      */
267     public void setRuleIsBlocking(final String value)
268     {
269         this.ruleIsBlocking = value;
270     }
271 
272     /**
273      * TODO: Model Documentation for attribute ruleErrorMsg
274      * Get the ruleErrorMsg Attribute
275      * @return ruleErrorMsg String
276      */
277     public String getRuleErrorMsg()
278     {
279         return this.ruleErrorMsg;
280     }
281 
282     /**
283      * 
284      * @param value String
285      */
286     public void setRuleErrorMsg(final String value)
287     {
288         this.ruleErrorMsg = value;
289     }
290 
291     /**
292      * TODO: Model Documentation for attribute updateDt
293      * Get the updateDt Attribute
294      * @return updateDt Timestamp
295      */
296     public Timestamp getUpdateDt()
297     {
298         return this.updateDt;
299     }
300 
301     /**
302      * 
303      * @param value Timestamp
304      */
305     public void setUpdateDt(final Timestamp value)
306     {
307         this.updateDt = value;
308     }
309 
310     /**
311      * TODO: Model Documentation for attribute ruleListCd
312      * Get the ruleListCd Attribute
313      * @return ruleListCd String
314      */
315     public String getRuleListCd()
316     {
317         return this.ruleListCd;
318     }
319 
320     /**
321      * 
322      * @param value String
323      */
324     public void setRuleListCd(final String value)
325     {
326         this.ruleListCd = value;
327     }
328 
329     /**
330      * TODO: Model Documentation for attribute functionId
331      * Get the functionId Attribute
332      * @return functionId Integer
333      */
334     public Integer getFunctionId()
335     {
336         return this.functionId;
337     }
338 
339     /**
340      * 
341      * @param value Integer
342      */
343     public void setFunctionId(final Integer value)
344     {
345         this.functionId = value;
346     }
347 
348     /**
349      * TODO: Model Documentation for association ruleParameterVOs
350      * Get the ruleParameterVOs Association
351      * This accessor method returns a reference to the live list,
352      * not a snapshot. Therefore any modification you make to the
353      * returned list will be present inside the object.
354      * @return this.ruleParameterVOs RuleParameterVO[]
355      */
356     public RuleParameterVO[] getRuleParameterVOs()
357     {
358         return this.ruleParameterVOs;
359     }
360 
361     /**
362      * Sets the ruleParameterVOs
363      * @param value RuleParameterVO[]
364      */
365     public void setRuleParameterVOs(RuleParameterVO[] value)
366     {
367         this.ruleParameterVOs = value;
368     }
369 
370     /**
371      * TODO: Model Documentation for association ruleListVO
372      * Get the ruleListVO Association
373      * @return this.ruleListVO RuleListVO
374      */
375     public RuleListVO getRuleListVO()
376     {
377         return this.ruleListVO;
378     }
379 
380     /**
381      * Sets the ruleListVO
382      * @param value RuleListVO
383      */
384     public void setRuleListVO(RuleListVO value)
385     {
386         this.ruleListVO = value;
387     }
388 
389     /**
390      * TODO: Model Documentation for association rulePmfmVOs
391      * Get the rulePmfmVOs Association
392      * This accessor method returns a reference to the live list,
393      * not a snapshot. Therefore any modification you make to the
394      * returned list will be present inside the object.
395      * @return this.rulePmfmVOs RulePmfmVO[]
396      */
397     public RulePmfmVO[] getRulePmfmVOs()
398     {
399         return this.rulePmfmVOs;
400     }
401 
402     /**
403      * Sets the rulePmfmVOs
404      * @param value RulePmfmVO[]
405      */
406     public void setRulePmfmVOs(RulePmfmVO[] value)
407     {
408         this.rulePmfmVOs = value;
409     }
410 
411     /**
412      * @param object to compare this object against
413      * @return boolean if equal
414      * @see Object#equals(Object)
415      */
416     @Override
417     public boolean equals(final Object object)
418     {
419         if (object==null || object.getClass() != this.getClass())
420         {
421              return false;
422         }
423         // Check if the same object instance
424         if (object==this)
425         {
426             return true;
427         }
428         RuleVO rhs = (RuleVO) object;
429         return new EqualsBuilder()
430             .append(this.getRuleCd(), rhs.getRuleCd())
431             .append(this.getRuleControledAttribut(), rhs.getRuleControledAttribut())
432             .append(this.getRuleDc(), rhs.getRuleDc())
433             .append(this.getRuleIsActive(), rhs.getRuleIsActive())
434             .append(this.getRuleIsBlocking(), rhs.getRuleIsBlocking())
435             .append(this.getRuleErrorMsg(), rhs.getRuleErrorMsg())
436             .append(this.getUpdateDt(), rhs.getUpdateDt())
437             .append(this.getRuleListCd(), rhs.getRuleListCd())
438             .append(this.getFunctionId(), rhs.getFunctionId())
439             .append(this.getRuleParameterVOs(), rhs.getRuleParameterVOs())
440             .append(this.getRuleListVO(), rhs.getRuleListVO())
441             .append(this.getRulePmfmVOs(), rhs.getRulePmfmVOs())
442             .isEquals();
443     }
444 
445     /**
446      * @param object to compare this object against
447      * @return int if equal
448      * @see Comparable#compareTo(Object)
449      */
450     public int compareTo(final RuleVO object)
451     {
452         if (object==null)
453         {
454             return -1;
455         }
456         // Check if the same object instance
457         if (object==this)
458         {
459             return 0;
460         }
461         return new CompareToBuilder()
462             .append(this.getRuleCd(), object.getRuleCd())
463             .append(this.getRuleControledAttribut(), object.getRuleControledAttribut())
464             .append(this.getRuleDc(), object.getRuleDc())
465             .append(this.getRuleIsActive(), object.getRuleIsActive())
466             .append(this.getRuleIsBlocking(), object.getRuleIsBlocking())
467             .append(this.getRuleErrorMsg(), object.getRuleErrorMsg())
468             .append(this.getUpdateDt(), object.getUpdateDt())
469             .append(this.getRuleListCd(), object.getRuleListCd())
470             .append(this.getFunctionId(), object.getFunctionId())
471             .append(this.getRuleParameterVOs(), object.getRuleParameterVOs())
472             .append(this.getRuleListVO(), object.getRuleListVO())
473             .append(this.getRulePmfmVOs(), object.getRulePmfmVOs())
474             .toComparison();
475     }
476 
477     /**
478      * @return int hashCode value
479      * @see Object#hashCode()
480      */
481     @Override
482     public int hashCode()
483     {
484         return new HashCodeBuilder(1249046965, -82296885)
485             .append(this.getRuleCd())
486             .append(this.getRuleControledAttribut())
487             .append(this.getRuleDc())
488             .append(this.getRuleIsActive())
489             .append(this.getRuleIsBlocking())
490             .append(this.getRuleErrorMsg())
491             .append(this.getUpdateDt())
492             .append(this.getRuleListCd())
493             .append(this.getFunctionId())
494             //Commented out to avoid commons-lang-2.4 recursion StackOverflowError: https://issues.apache.org/jira/browse/LANG-456
495             //.append(this.getRuleParameterVOs())
496             .append(this.getRuleListVO())
497             //Commented out to avoid commons-lang-2.4 recursion StackOverflowError: https://issues.apache.org/jira/browse/LANG-456
498             //.append(this.getRulePmfmVOs())
499             .toHashCode();
500     }
501 
502     /**
503      * @return String representation of object
504      * @see Object#toString()
505      */
506     @Override
507     public String toString()
508     {
509         return new ToStringBuilder(this)
510             .append("ruleCd", this.getRuleCd())
511             .append("ruleControledAttribut", this.getRuleControledAttribut())
512             .append("ruleDc", this.getRuleDc())
513             .append("ruleIsActive", this.getRuleIsActive())
514             .append("ruleIsBlocking", this.getRuleIsBlocking())
515             .append("ruleErrorMsg", this.getRuleErrorMsg())
516             .append("updateDt", this.getUpdateDt())
517             .append("ruleListCd", this.getRuleListCd())
518             .append("functionId", this.getFunctionId())
519             .append("ruleParameterVOs", this.getRuleParameterVOs())
520             .append("ruleListVO", this.getRuleListVO())
521             .append("rulePmfmVOs", this.getRulePmfmVOs())
522             .toString();
523     }
524 
525     /**
526      * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
527      * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
528      * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
529      *
530      * <p/>Note that for array, collection or map instances the comparison runs one level deep.
531      *
532      * @param first the first object to compare, may be {@code null}
533      * @param second the second object to compare, may be {@code null}
534      * @return this method will return {@code true} in case both objects are equal as explained above;
535      *      in all other cases this method will return {@code false}
536      */
537     protected static boolean equal(final Object first, final Object second)
538     {
539         final boolean equal;
540 
541         if (first == null)
542         {
543             equal = (second == null);
544         }
545         else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
546         {
547             equal = Arrays.equals((Object[])first, (Object[])second);
548         }
549         else // note that the following also covers java.util.Collection and java.util.Map
550         {
551             equal = first.equals(second);
552         }
553 
554         return equal;
555     }
556 
557     // RuleVO value-object java merge-point
558 }