View Javadoc
1   /*
2     * #%L
3     * Quadrige3 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 07/22/2024 16:45:05+0200 Do not modify by hand!
24   *
25   * TEMPLATE:     ValueObject.vsl in andromda-java-cartridge.
26   * MODEL CLASS:  Données::fr.ifremer.quadrige3.core::vo::system::rule::RulePreconditionVO
27   * STEREOTYPE:   ValueObject
28   */
29  package fr.ifremer.quadrige3.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 RulePreconditionVO
41   */
42  public class RulePreconditionVO
43      implements Serializable, Comparable<RulePreconditionVO>
44  {
45      /** The serial version UID of this class. Needed for serialization. */
46      private static final long serialVersionUID = 1281007992127533019L;
47  
48      // Class attributes
49      /** TODO: Model Documentation for attribute rulePrecondId */
50      protected Integer rulePrecondId;
51      /** TODO: Model Documentation for attribute rulePrecondLb */
52      protected String rulePrecondLb;
53      /** TODO: Model Documentation for attribute rulePrecondIsBidir */
54      protected String rulePrecondIsBidir;
55      /** TODO: Model Documentation for attribute rulePrecondIsActive */
56      protected String rulePrecondIsActive;
57      /** TODO: Model Documentation for attribute updateDt */
58      protected Timestamp updateDt;
59      /** TODO: Model Documentation for attribute ruleCd */
60      protected String ruleCd;
61      /** TODO: Model Documentation for attribute usedRuleCd */
62      protected String usedRuleCd;
63  
64      // Class associationEnds
65      /** TODO: Model Documentation for attribute ruleVO */
66      protected RuleVO ruleVO;
67  
68      /** Default Constructor with no properties */
69      public RulePreconditionVO()
70      {
71          // Documented empty block - avoid compiler warning - no super constructor
72      }
73  
74      /**
75       * Constructor taking only required properties
76       * @param rulePrecondIdIn Integer
77       * @param rulePrecondLbIn String
78       * @param rulePrecondIsBidirIn String
79       * @param rulePrecondIsActiveIn String
80       * @param ruleCdIn String
81       * @param usedRuleCdIn String
82       * @param ruleVOIn RuleVO
83       */
84      public RulePreconditionVO(final Integer rulePrecondIdIn, final String rulePrecondLbIn, final String rulePrecondIsBidirIn, final String rulePrecondIsActiveIn, final String ruleCdIn, final String usedRuleCdIn, final RuleVO ruleVOIn)
85      {
86          this.rulePrecondId = rulePrecondIdIn;
87          this.rulePrecondLb = rulePrecondLbIn;
88          this.rulePrecondIsBidir = rulePrecondIsBidirIn;
89          this.rulePrecondIsActive = rulePrecondIsActiveIn;
90          this.ruleCd = ruleCdIn;
91          this.usedRuleCd = usedRuleCdIn;
92          this.ruleVO = ruleVOIn;
93      }
94  
95      /**
96       * Constructor with all properties
97       * @param rulePrecondIdIn Integer
98       * @param rulePrecondLbIn String
99       * @param rulePrecondIsBidirIn String
100      * @param rulePrecondIsActiveIn String
101      * @param updateDtIn Timestamp
102      * @param ruleCdIn String
103      * @param usedRuleCdIn String
104      * @param ruleVOIn RuleVO
105      */
106     public RulePreconditionVO(final Integer rulePrecondIdIn, final String rulePrecondLbIn, final String rulePrecondIsBidirIn, final String rulePrecondIsActiveIn, final Timestamp updateDtIn, final String ruleCdIn, final String usedRuleCdIn, final RuleVO ruleVOIn)
107     {
108         this.rulePrecondId = rulePrecondIdIn;
109         this.rulePrecondLb = rulePrecondLbIn;
110         this.rulePrecondIsBidir = rulePrecondIsBidirIn;
111         this.rulePrecondIsActive = rulePrecondIsActiveIn;
112         this.updateDt = updateDtIn;
113         this.ruleCd = ruleCdIn;
114         this.usedRuleCd = usedRuleCdIn;
115         this.ruleVO = ruleVOIn;
116     }
117 
118     /**
119      * Copies constructor from other RulePreconditionVO
120      *
121      * @param otherBean Cannot be <code>null</code>
122      * @throws NullPointerException if the argument is <code>null</code>
123      */
124     public RulePreconditionVO(final RulePreconditionVO otherBean)
125     {
126         this.rulePrecondId = otherBean.getRulePrecondId();
127         this.rulePrecondLb = otherBean.getRulePrecondLb();
128         this.rulePrecondIsBidir = otherBean.getRulePrecondIsBidir();
129         this.rulePrecondIsActive = otherBean.getRulePrecondIsActive();
130         this.updateDt = otherBean.getUpdateDt();
131         this.ruleCd = otherBean.getRuleCd();
132         this.usedRuleCd = otherBean.getUsedRuleCd();
133         this.ruleVO = otherBean.getRuleVO();
134     }
135 
136     /**
137      * Copies all properties from the argument value object into this value object.
138      * @param otherBean Cannot be <code>null</code>
139      */
140     public void copy(final RulePreconditionVO otherBean)
141     {
142         if (null != otherBean)
143         {
144             this.setRulePrecondId(otherBean.getRulePrecondId());
145             this.setRulePrecondLb(otherBean.getRulePrecondLb());
146             this.setRulePrecondIsBidir(otherBean.getRulePrecondIsBidir());
147             this.setRulePrecondIsActive(otherBean.getRulePrecondIsActive());
148             this.setUpdateDt(otherBean.getUpdateDt());
149             this.setRuleCd(otherBean.getRuleCd());
150             this.setUsedRuleCd(otherBean.getUsedRuleCd());
151             this.setRuleVO(otherBean.getRuleVO());
152         }
153     }
154 
155     /**
156      * TODO: Model Documentation for attribute rulePrecondId
157      * Get the rulePrecondId Attribute
158      * @return rulePrecondId Integer
159      */
160     public Integer getRulePrecondId()
161     {
162         return this.rulePrecondId;
163     }
164 
165     /**
166      * 
167      * @param value Integer
168      */
169     public void setRulePrecondId(final Integer value)
170     {
171         this.rulePrecondId = value;
172     }
173 
174     /**
175      * TODO: Model Documentation for attribute rulePrecondLb
176      * Get the rulePrecondLb Attribute
177      * @return rulePrecondLb String
178      */
179     public String getRulePrecondLb()
180     {
181         return this.rulePrecondLb;
182     }
183 
184     /**
185      * 
186      * @param value String
187      */
188     public void setRulePrecondLb(final String value)
189     {
190         this.rulePrecondLb = value;
191     }
192 
193     /**
194      * TODO: Model Documentation for attribute rulePrecondIsBidir
195      * Get the rulePrecondIsBidir Attribute
196      * @return rulePrecondIsBidir String
197      */
198     public String getRulePrecondIsBidir()
199     {
200         return this.rulePrecondIsBidir;
201     }
202 
203     /**
204      * 
205      * @param value String
206      */
207     public void setRulePrecondIsBidir(final String value)
208     {
209         this.rulePrecondIsBidir = value;
210     }
211 
212     /**
213      * TODO: Model Documentation for attribute rulePrecondIsActive
214      * Get the rulePrecondIsActive Attribute
215      * @return rulePrecondIsActive String
216      */
217     public String getRulePrecondIsActive()
218     {
219         return this.rulePrecondIsActive;
220     }
221 
222     /**
223      * 
224      * @param value String
225      */
226     public void setRulePrecondIsActive(final String value)
227     {
228         this.rulePrecondIsActive = value;
229     }
230 
231     /**
232      * TODO: Model Documentation for attribute updateDt
233      * Get the updateDt Attribute
234      * @return updateDt Timestamp
235      */
236     public Timestamp getUpdateDt()
237     {
238         return this.updateDt;
239     }
240 
241     /**
242      * 
243      * @param value Timestamp
244      */
245     public void setUpdateDt(final Timestamp value)
246     {
247         this.updateDt = value;
248     }
249 
250     /**
251      * TODO: Model Documentation for attribute ruleCd
252      * Get the ruleCd Attribute
253      * @return ruleCd String
254      */
255     public String getRuleCd()
256     {
257         return this.ruleCd;
258     }
259 
260     /**
261      * 
262      * @param value String
263      */
264     public void setRuleCd(final String value)
265     {
266         this.ruleCd = value;
267     }
268 
269     /**
270      * TODO: Model Documentation for attribute usedRuleCd
271      * Get the usedRuleCd Attribute
272      * @return usedRuleCd String
273      */
274     public String getUsedRuleCd()
275     {
276         return this.usedRuleCd;
277     }
278 
279     /**
280      * 
281      * @param value String
282      */
283     public void setUsedRuleCd(final String value)
284     {
285         this.usedRuleCd = value;
286     }
287 
288     /**
289      * TODO: Model Documentation for association ruleVO
290      * Get the ruleVO Association
291      * @return this.ruleVO RuleVO
292      */
293     public RuleVO getRuleVO()
294     {
295         return this.ruleVO;
296     }
297 
298     /**
299      * Sets the ruleVO
300      * @param value RuleVO
301      */
302     public void setRuleVO(RuleVO value)
303     {
304         this.ruleVO = value;
305     }
306 
307     /**
308      * @param object to compare this object against
309      * @return boolean if equal
310      * @see Object#equals(Object)
311      */
312     @Override
313     public boolean equals(final Object object)
314     {
315         if (object==null || object.getClass() != this.getClass())
316         {
317              return false;
318         }
319         // Check if the same object instance
320         if (object==this)
321         {
322             return true;
323         }
324         RulePreconditionVO rhs = (RulePreconditionVO) object;
325         return new EqualsBuilder()
326             .append(this.getRulePrecondId(), rhs.getRulePrecondId())
327             .append(this.getRulePrecondLb(), rhs.getRulePrecondLb())
328             .append(this.getRulePrecondIsBidir(), rhs.getRulePrecondIsBidir())
329             .append(this.getRulePrecondIsActive(), rhs.getRulePrecondIsActive())
330             .append(this.getUpdateDt(), rhs.getUpdateDt())
331             .append(this.getRuleCd(), rhs.getRuleCd())
332             .append(this.getUsedRuleCd(), rhs.getUsedRuleCd())
333             .append(this.getRuleVO(), rhs.getRuleVO())
334             .isEquals();
335     }
336 
337     /**
338      * @param object to compare this object against
339      * @return int if equal
340      * @see Comparable#compareTo(Object)
341      */
342     public int compareTo(final RulePreconditionVO object)
343     {
344         if (object==null)
345         {
346             return -1;
347         }
348         // Check if the same object instance
349         if (object==this)
350         {
351             return 0;
352         }
353         return new CompareToBuilder()
354             .append(this.getRulePrecondId(), object.getRulePrecondId())
355             .append(this.getRulePrecondLb(), object.getRulePrecondLb())
356             .append(this.getRulePrecondIsBidir(), object.getRulePrecondIsBidir())
357             .append(this.getRulePrecondIsActive(), object.getRulePrecondIsActive())
358             .append(this.getUpdateDt(), object.getUpdateDt())
359             .append(this.getRuleCd(), object.getRuleCd())
360             .append(this.getUsedRuleCd(), object.getUsedRuleCd())
361             .append(this.getRuleVO(), object.getRuleVO())
362             .toComparison();
363     }
364 
365     /**
366      * @return int hashCode value
367      * @see Object#hashCode()
368      */
369     @Override
370     public int hashCode()
371     {
372         return new HashCodeBuilder(1249046965, -82296885)
373             .append(this.getRulePrecondId())
374             .append(this.getRulePrecondLb())
375             .append(this.getRulePrecondIsBidir())
376             .append(this.getRulePrecondIsActive())
377             .append(this.getUpdateDt())
378             .append(this.getRuleCd())
379             .append(this.getUsedRuleCd())
380             //Commented out to avoid commons-lang-2.4 recursion StackOverflowError: https://issues.apache.org/jira/browse/LANG-456
381             //.append(this.getRuleVO())
382             .toHashCode();
383     }
384 
385     /**
386      * @return String representation of object
387      * @see Object#toString()
388      */
389     @Override
390     public String toString()
391     {
392         return new ToStringBuilder(this)
393             .append("rulePrecondId", this.getRulePrecondId())
394             .append("rulePrecondLb", this.getRulePrecondLb())
395             .append("rulePrecondIsBidir", this.getRulePrecondIsBidir())
396             .append("rulePrecondIsActive", this.getRulePrecondIsActive())
397             .append("updateDt", this.getUpdateDt())
398             .append("ruleCd", this.getRuleCd())
399             .append("usedRuleCd", this.getUsedRuleCd())
400             .append("ruleVO", this.getRuleVO())
401             .toString();
402     }
403 
404     /**
405      * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
406      * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
407      * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
408      *
409      * <p/>Note that for array, collection or map instances the comparison runs one level deep.
410      *
411      * @param first the first object to compare, may be {@code null}
412      * @param second the second object to compare, may be {@code null}
413      * @return this method will return {@code true} in case both objects are equal as explained above;
414      *      in all other cases this method will return {@code false}
415      */
416     protected static boolean equal(final Object first, final Object second)
417     {
418         final boolean equal;
419 
420         if (first == null)
421         {
422             equal = (second == null);
423         }
424         else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
425         {
426             equal = Arrays.equals((Object[])first, (Object[])second);
427         }
428         else // note that the following also covers java.util.Collection and java.util.Map
429         {
430             equal = first.equals(second);
431         }
432 
433         return equal;
434     }
435 
436     // RulePreconditionVO value-object java merge-point
437 }