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::administration::program::ProgDepProgPrivVO
27   * STEREOTYPE:   ValueObject
28   */
29  package fr.ifremer.quadrige3.core.vo.administration.program;
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   * Liste des droits d'un service pour un programme particulier.
41   */
42  public class ProgDepProgPrivVO
43      implements Serializable, Comparable<ProgDepProgPrivVO>
44  {
45      /** The serial version UID of this class. Needed for serialization. */
46      private static final long serialVersionUID = -3227761431820499643L;
47  
48      // Class attributes
49      /**
50       * Date de modification de l'objet, mise à jour par le système
51       */
52      protected Timestamp updateDt;
53      /**
54       * Identifiant interne d'un service
55       */
56      protected Integer depId;
57      /**
58       * Identifiant du privilège (droit) sur les programmes
59       */
60      protected Integer progPrivId;
61      /** TODO: Model Documentation for attribute progCd */
62      protected String progCd;
63  
64      // Class associationEnds
65      /**
66       * Activités à l'origine de la collecte d'un ensemble cohérent de données.
67       */
68      protected ProgramVO programVO;
69  
70      /** Default Constructor with no properties */
71      public ProgDepProgPrivVO()
72      {
73          // Documented empty block - avoid compiler warning - no super constructor
74      }
75  
76      /**
77       * Constructor taking only required properties
78       * @param depIdIn Integer Identifiant interne d'un service
79       * @param progPrivIdIn Integer Identifiant du privilège (droit) sur les programmes
80       * @param progCdIn String
81       * @param programVOIn ProgramVO Activités à l'origine de la collecte d'un ensemble cohérent de données.
82       */
83      public ProgDepProgPrivVO(final Integer depIdIn, final Integer progPrivIdIn, final String progCdIn, final ProgramVO programVOIn)
84      {
85          this.depId = depIdIn;
86          this.progPrivId = progPrivIdIn;
87          this.progCd = progCdIn;
88          this.programVO = programVOIn;
89      }
90  
91      /**
92       * Constructor with all properties
93       * @param updateDtIn Timestamp
94       * @param depIdIn Integer
95       * @param progPrivIdIn Integer
96       * @param progCdIn String
97       * @param programVOIn ProgramVO
98       */
99      public ProgDepProgPrivVO(final Timestamp updateDtIn, final Integer depIdIn, final Integer progPrivIdIn, final String progCdIn, final ProgramVO programVOIn)
100     {
101         this.updateDt = updateDtIn;
102         this.depId = depIdIn;
103         this.progPrivId = progPrivIdIn;
104         this.progCd = progCdIn;
105         this.programVO = programVOIn;
106     }
107 
108     /**
109      * Copies constructor from other ProgDepProgPrivVO
110      *
111      * @param otherBean Cannot be <code>null</code>
112      * @throws NullPointerException if the argument is <code>null</code>
113      */
114     public ProgDepProgPrivVO(final ProgDepProgPrivVO otherBean)
115     {
116         this.updateDt = otherBean.getUpdateDt();
117         this.depId = otherBean.getDepId();
118         this.progPrivId = otherBean.getProgPrivId();
119         this.progCd = otherBean.getProgCd();
120         this.programVO = otherBean.getProgramVO();
121     }
122 
123     /**
124      * Copies all properties from the argument value object into this value object.
125      * @param otherBean Cannot be <code>null</code>
126      */
127     public void copy(final ProgDepProgPrivVO otherBean)
128     {
129         if (null != otherBean)
130         {
131             this.setUpdateDt(otherBean.getUpdateDt());
132             this.setDepId(otherBean.getDepId());
133             this.setProgPrivId(otherBean.getProgPrivId());
134             this.setProgCd(otherBean.getProgCd());
135             this.setProgramVO(otherBean.getProgramVO());
136         }
137     }
138 
139     /**
140      * Date de modification de l'objet, mise à jour par le système
141      * Get the updateDt Attribute
142      * @return updateDt Timestamp
143      */
144     public Timestamp getUpdateDt()
145     {
146         return this.updateDt;
147     }
148 
149     /**
150      * Date de modification de l'objet, mise à jour par le système
151      * @param value Timestamp
152      */
153     public void setUpdateDt(final Timestamp value)
154     {
155         this.updateDt = value;
156     }
157 
158     /**
159      * Identifiant interne d'un service
160      * Get the depId Attribute
161      * @return depId Integer
162      */
163     public Integer getDepId()
164     {
165         return this.depId;
166     }
167 
168     /**
169      * Identifiant interne d'un service
170      * @param value Integer
171      */
172     public void setDepId(final Integer value)
173     {
174         this.depId = value;
175     }
176 
177     /**
178      * Identifiant du privilège (droit) sur les programmes
179      * Get the progPrivId Attribute
180      * @return progPrivId Integer
181      */
182     public Integer getProgPrivId()
183     {
184         return this.progPrivId;
185     }
186 
187     /**
188      * Identifiant du privilège (droit) sur les programmes
189      * @param value Integer
190      */
191     public void setProgPrivId(final Integer value)
192     {
193         this.progPrivId = value;
194     }
195 
196     /**
197      * TODO: Model Documentation for attribute progCd
198      * Get the progCd Attribute
199      * @return progCd String
200      */
201     public String getProgCd()
202     {
203         return this.progCd;
204     }
205 
206     /**
207      * 
208      * @param value String
209      */
210     public void setProgCd(final String value)
211     {
212         this.progCd = value;
213     }
214 
215     /**
216      * Activités à l'origine de la collecte d'un ensemble cohérent de données.
217      * Get the programVO Association
218      * @return this.programVO ProgramVO
219      */
220     public ProgramVO getProgramVO()
221     {
222         return this.programVO;
223     }
224 
225     /**
226      * Sets the programVO
227      * @param value ProgramVO
228      */
229     public void setProgramVO(ProgramVO value)
230     {
231         this.programVO = value;
232     }
233 
234     /**
235      * @param object to compare this object against
236      * @return boolean if equal
237      * @see Object#equals(Object)
238      */
239     @Override
240     public boolean equals(final Object object)
241     {
242         if (object==null || object.getClass() != this.getClass())
243         {
244              return false;
245         }
246         // Check if the same object instance
247         if (object==this)
248         {
249             return true;
250         }
251         ProgDepProgPrivVO rhs = (ProgDepProgPrivVO) object;
252         return new EqualsBuilder()
253             .append(this.getUpdateDt(), rhs.getUpdateDt())
254             .append(this.getDepId(), rhs.getDepId())
255             .append(this.getProgPrivId(), rhs.getProgPrivId())
256             .append(this.getProgCd(), rhs.getProgCd())
257             .append(this.getProgramVO(), rhs.getProgramVO())
258             .isEquals();
259     }
260 
261     /**
262      * @param object to compare this object against
263      * @return int if equal
264      * @see Comparable#compareTo(Object)
265      */
266     public int compareTo(final ProgDepProgPrivVO object)
267     {
268         if (object==null)
269         {
270             return -1;
271         }
272         // Check if the same object instance
273         if (object==this)
274         {
275             return 0;
276         }
277         return new CompareToBuilder()
278             .append(this.getUpdateDt(), object.getUpdateDt())
279             .append(this.getDepId(), object.getDepId())
280             .append(this.getProgPrivId(), object.getProgPrivId())
281             .append(this.getProgCd(), object.getProgCd())
282             .append(this.getProgramVO(), object.getProgramVO())
283             .toComparison();
284     }
285 
286     /**
287      * @return int hashCode value
288      * @see Object#hashCode()
289      */
290     @Override
291     public int hashCode()
292     {
293         return new HashCodeBuilder(1249046965, -82296885)
294             .append(this.getUpdateDt())
295             .append(this.getDepId())
296             .append(this.getProgPrivId())
297             .append(this.getProgCd())
298             .append(this.getProgramVO())
299             .toHashCode();
300     }
301 
302     /**
303      * @return String representation of object
304      * @see Object#toString()
305      */
306     @Override
307     public String toString()
308     {
309         return new ToStringBuilder(this)
310             .append("updateDt", this.getUpdateDt())
311             .append("depId", this.getDepId())
312             .append("progPrivId", this.getProgPrivId())
313             .append("progCd", this.getProgCd())
314             .append("programVO", this.getProgramVO())
315             .toString();
316     }
317 
318     /**
319      * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
320      * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
321      * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
322      *
323      * <p/>Note that for array, collection or map instances the comparison runs one level deep.
324      *
325      * @param first the first object to compare, may be {@code null}
326      * @param second the second object to compare, may be {@code null}
327      * @return this method will return {@code true} in case both objects are equal as explained above;
328      *      in all other cases this method will return {@code false}
329      */
330     protected static boolean equal(final Object first, final Object second)
331     {
332         final boolean equal;
333 
334         if (first == null)
335         {
336             equal = (second == null);
337         }
338         else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
339         {
340             equal = Arrays.equals((Object[])first, (Object[])second);
341         }
342         else // note that the following also covers java.util.Collection and java.util.Map
343         {
344             equal = first.equals(second);
345         }
346 
347         return equal;
348     }
349 
350     // ProgDepProgPrivVO value-object java merge-point
351 }