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