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::user::DepartmentVO
27   * STEREOTYPE:   ValueObject
28   */
29  package fr.ifremer.quadrige3.core.vo.administration.user;
30  
31  import java.io.Serializable;
32  import java.sql.Timestamp;
33  import java.util.Arrays;
34  import java.util.Date;
35  import org.apache.commons.lang3.builder.CompareToBuilder;
36  import org.apache.commons.lang3.builder.EqualsBuilder;
37  import org.apache.commons.lang3.builder.HashCodeBuilder;
38  import org.apache.commons.lang3.builder.ToStringBuilder;
39  
40  /**
41   * Liste les départements ou services auxquels sont rattachés les agents
42   */
43  public class DepartmentVO
44      implements Serializable, Comparable<DepartmentVO>
45  {
46      /** The serial version UID of this class. Needed for serialization. */
47      private static final long serialVersionUID = 4776030081060966098L;
48  
49      // Class attributes
50      /**
51       * Identifiant interne d'un service
52       */
53      protected Integer depId;
54      /**
55       * Code (sigle dans LDAP : identifie de manière unique un service dans LDAP, attribut
56       * obligatoire dans LDAP).
57       */
58      protected String depCd;
59      /**
60       * Libellé du service issue de l'intitulé dans le LDAP si existant (taillé comme une description
61       * car les infos venant de LDAP dépassent les 100 caractères)
62       */
63      protected String depNm;
64      /**
65       * Description issue de l'activité LDAP
66       */
67      protected String depDc;
68      /**
69       * Mail associé au service
70       */
71      protected String depEMail;
72      /**
73       * Adresse du site dans le LDAP, ou informations sur l'adresse de l'utilisateur.
74       */
75      protected String depAddress;
76      /**
77       * Les téléphones du service.
78       */
79      protected String depPhone;
80      /**
81       * Oui, si le service est présent dans le LDAP
82       */
83      protected String depLdapPresent;
84      /**
85       * Date de création de l'objet
86       */
87      protected Date depCreationDt;
88      /**
89       * Date de modification de l'objet
90       */
91      protected Timestamp updateDt;
92      /**
93       * Code de l'état de l'objet (actif ou inactif)
94       */
95      protected String statusCd;
96      /** TODO: Model Documentation for attribute parentDepartmentId */
97      protected Integer parentDepartmentId;
98  
99      // Class associationEnds
100     /** TODO: Model Documentation for attribute privileges */
101     protected PrivilegeVO[] privileges;
102 
103     /** Default Constructor with no properties */
104     public DepartmentVO()
105     {
106         // Documented empty block - avoid compiler warning - no super constructor
107     }
108 
109     /**
110      * Constructor taking only required properties
111      * @param depIdIn Integer Identifiant interne d'un service
112      * @param depCdIn String Code (sigle dans LDAP : identifie de manière unique un service dans LDAP, attribut obligatoire dans
113 LDAP).
114      * @param depNmIn String Libellé du service issue de l'intitulé dans le LDAP si existant (taillé comme une description car
115 les infos venant de LDAP dépassent les 100 caractères)
116      * @param statusCdIn String Code de l'état de l'objet (actif ou inactif)
117      */
118     public DepartmentVO(final Integer depIdIn, final String depCdIn, final String depNmIn, final String statusCdIn)
119     {
120         this.depId = depIdIn;
121         this.depCd = depCdIn;
122         this.depNm = depNmIn;
123         this.statusCd = statusCdIn;
124     }
125 
126     /**
127      * Constructor with all properties
128      * @param depIdIn Integer
129      * @param depCdIn String
130      * @param depNmIn String
131      * @param depDcIn String
132      * @param depEMailIn String
133      * @param depAddressIn String
134      * @param depPhoneIn String
135      * @param depLdapPresentIn String
136      * @param depCreationDtIn Date
137      * @param updateDtIn Timestamp
138      * @param statusCdIn String
139      * @param parentDepartmentIdIn Integer
140      * @param privilegesIn PrivilegeVO[]
141      */
142     public DepartmentVO(final Integer depIdIn, final String depCdIn, final String depNmIn, final String depDcIn, final String depEMailIn, final String depAddressIn, final String depPhoneIn, final String depLdapPresentIn, final Date depCreationDtIn, final Timestamp updateDtIn, final String statusCdIn, final Integer parentDepartmentIdIn, final PrivilegeVO[] privilegesIn)
143     {
144         this.depId = depIdIn;
145         this.depCd = depCdIn;
146         this.depNm = depNmIn;
147         this.depDc = depDcIn;
148         this.depEMail = depEMailIn;
149         this.depAddress = depAddressIn;
150         this.depPhone = depPhoneIn;
151         this.depLdapPresent = depLdapPresentIn;
152         this.depCreationDt = depCreationDtIn;
153         this.updateDt = updateDtIn;
154         this.statusCd = statusCdIn;
155         this.parentDepartmentId = parentDepartmentIdIn;
156         this.privileges = privilegesIn;
157     }
158 
159     /**
160      * Copies constructor from other DepartmentVO
161      *
162      * @param otherBean Cannot be <code>null</code>
163      * @throws NullPointerException if the argument is <code>null</code>
164      */
165     public DepartmentVO(final DepartmentVO otherBean)
166     {
167         this.depId = otherBean.getDepId();
168         this.depCd = otherBean.getDepCd();
169         this.depNm = otherBean.getDepNm();
170         this.depDc = otherBean.getDepDc();
171         this.depEMail = otherBean.getDepEMail();
172         this.depAddress = otherBean.getDepAddress();
173         this.depPhone = otherBean.getDepPhone();
174         this.depLdapPresent = otherBean.getDepLdapPresent();
175         this.depCreationDt = otherBean.getDepCreationDt();
176         this.updateDt = otherBean.getUpdateDt();
177         this.statusCd = otherBean.getStatusCd();
178         this.parentDepartmentId = otherBean.getParentDepartmentId();
179         this.privileges = otherBean.getPrivileges();
180     }
181 
182     /**
183      * Copies all properties from the argument value object into this value object.
184      * @param otherBean Cannot be <code>null</code>
185      */
186     public void copy(final DepartmentVO otherBean)
187     {
188         if (null != otherBean)
189         {
190             this.setDepId(otherBean.getDepId());
191             this.setDepCd(otherBean.getDepCd());
192             this.setDepNm(otherBean.getDepNm());
193             this.setDepDc(otherBean.getDepDc());
194             this.setDepEMail(otherBean.getDepEMail());
195             this.setDepAddress(otherBean.getDepAddress());
196             this.setDepPhone(otherBean.getDepPhone());
197             this.setDepLdapPresent(otherBean.getDepLdapPresent());
198             this.setDepCreationDt(otherBean.getDepCreationDt());
199             this.setUpdateDt(otherBean.getUpdateDt());
200             this.setStatusCd(otherBean.getStatusCd());
201             this.setParentDepartmentId(otherBean.getParentDepartmentId());
202             this.setPrivileges(otherBean.getPrivileges());
203         }
204     }
205 
206     /**
207      * Identifiant interne d'un service
208      * Get the depId Attribute
209      * @return depId Integer
210      */
211     public Integer getDepId()
212     {
213         return this.depId;
214     }
215 
216     /**
217      * Identifiant interne d'un service
218      * @param value Integer
219      */
220     public void setDepId(final Integer value)
221     {
222         this.depId = value;
223     }
224 
225     /**
226      * Code (sigle dans LDAP : identifie de manière unique un service dans LDAP, attribut
227      * obligatoire dans LDAP).
228      * Get the depCd Attribute
229      * @return depCd String
230      */
231     public String getDepCd()
232     {
233         return this.depCd;
234     }
235 
236     /**
237      * Code (sigle dans LDAP : identifie de manière unique un service dans LDAP, attribut
238      * obligatoire dans LDAP).
239      * @param value String
240      */
241     public void setDepCd(final String value)
242     {
243         this.depCd = value;
244     }
245 
246     /**
247      * Libellé du service issue de l'intitulé dans le LDAP si existant (taillé comme une description
248      * car les infos venant de LDAP dépassent les 100 caractères)
249      * Get the depNm Attribute
250      * @return depNm String
251      */
252     public String getDepNm()
253     {
254         return this.depNm;
255     }
256 
257     /**
258      * Libellé du service issue de l'intitulé dans le LDAP si existant (taillé comme une description
259      * car les infos venant de LDAP dépassent les 100 caractères)
260      * @param value String
261      */
262     public void setDepNm(final String value)
263     {
264         this.depNm = value;
265     }
266 
267     /**
268      * Description issue de l'activité LDAP
269      * Get the depDc Attribute
270      * @return depDc String
271      */
272     public String getDepDc()
273     {
274         return this.depDc;
275     }
276 
277     /**
278      * Description issue de l'activité LDAP
279      * @param value String
280      */
281     public void setDepDc(final String value)
282     {
283         this.depDc = value;
284     }
285 
286     /**
287      * Mail associé au service
288      * Get the depEMail Attribute
289      * @return depEMail String
290      */
291     public String getDepEMail()
292     {
293         return this.depEMail;
294     }
295 
296     /**
297      * Mail associé au service
298      * @param value String
299      */
300     public void setDepEMail(final String value)
301     {
302         this.depEMail = value;
303     }
304 
305     /**
306      * Adresse du site dans le LDAP, ou informations sur l'adresse de l'utilisateur.
307      * Get the depAddress Attribute
308      * @return depAddress String
309      */
310     public String getDepAddress()
311     {
312         return this.depAddress;
313     }
314 
315     /**
316      * Adresse du site dans le LDAP, ou informations sur l'adresse de l'utilisateur.
317      * @param value String
318      */
319     public void setDepAddress(final String value)
320     {
321         this.depAddress = value;
322     }
323 
324     /**
325      * Les téléphones du service.
326      * Get the depPhone Attribute
327      * @return depPhone String
328      */
329     public String getDepPhone()
330     {
331         return this.depPhone;
332     }
333 
334     /**
335      * Les téléphones du service.
336      * @param value String
337      */
338     public void setDepPhone(final String value)
339     {
340         this.depPhone = value;
341     }
342 
343     /**
344      * Oui, si le service est présent dans le LDAP
345      * Get the depLdapPresent Attribute
346      * @return depLdapPresent String
347      */
348     public String getDepLdapPresent()
349     {
350         return this.depLdapPresent;
351     }
352 
353     /**
354      * Oui, si le service est présent dans le LDAP
355      * @param value String
356      */
357     public void setDepLdapPresent(final String value)
358     {
359         this.depLdapPresent = value;
360     }
361 
362     /**
363      * Date de création de l'objet
364      * Get the depCreationDt Attribute
365      * @return depCreationDt Date
366      */
367     public Date getDepCreationDt()
368     {
369         return this.depCreationDt;
370     }
371 
372     /**
373      * Date de création de l'objet
374      * @param value Date
375      */
376     public void setDepCreationDt(final Date value)
377     {
378         this.depCreationDt = value;
379     }
380 
381     /**
382      * Date de modification de l'objet
383      * Get the updateDt Attribute
384      * @return updateDt Timestamp
385      */
386     public Timestamp getUpdateDt()
387     {
388         return this.updateDt;
389     }
390 
391     /**
392      * Date de modification de l'objet
393      * @param value Timestamp
394      */
395     public void setUpdateDt(final Timestamp value)
396     {
397         this.updateDt = value;
398     }
399 
400     /**
401      * Code de l'état de l'objet (actif ou inactif)
402      * Get the statusCd Attribute
403      * @return statusCd String
404      */
405     public String getStatusCd()
406     {
407         return this.statusCd;
408     }
409 
410     /**
411      * Code de l'état de l'objet (actif ou inactif)
412      * @param value String
413      */
414     public void setStatusCd(final String value)
415     {
416         this.statusCd = value;
417     }
418 
419     /**
420      * TODO: Model Documentation for attribute parentDepartmentId
421      * Get the parentDepartmentId Attribute
422      * @return parentDepartmentId Integer
423      */
424     public Integer getParentDepartmentId()
425     {
426         return this.parentDepartmentId;
427     }
428 
429     /**
430      * 
431      * @param value Integer
432      */
433     public void setParentDepartmentId(final Integer value)
434     {
435         this.parentDepartmentId = value;
436     }
437 
438     /**
439      * TODO: Model Documentation for association privileges
440      * Get the privileges Association
441      * This accessor method returns a reference to the live list,
442      * not a snapshot. Therefore any modification you make to the
443      * returned list will be present inside the object.
444      * @return this.privileges PrivilegeVO[]
445      */
446     public PrivilegeVO[] getPrivileges()
447     {
448         return this.privileges;
449     }
450 
451     /**
452      * Sets the privileges
453      * @param value PrivilegeVO[]
454      */
455     public void setPrivileges(PrivilegeVO[] value)
456     {
457         this.privileges = value;
458     }
459 
460     /**
461      * @param object to compare this object against
462      * @return boolean if equal
463      * @see Object#equals(Object)
464      */
465     @Override
466     public boolean equals(final Object object)
467     {
468         if (object==null || object.getClass() != this.getClass())
469         {
470              return false;
471         }
472         // Check if the same object instance
473         if (object==this)
474         {
475             return true;
476         }
477         DepartmentVO rhs = (DepartmentVO) object;
478         return new EqualsBuilder()
479             .append(this.getDepId(), rhs.getDepId())
480             .append(this.getDepCd(), rhs.getDepCd())
481             .append(this.getDepNm(), rhs.getDepNm())
482             .append(this.getDepDc(), rhs.getDepDc())
483             .append(this.getDepEMail(), rhs.getDepEMail())
484             .append(this.getDepAddress(), rhs.getDepAddress())
485             .append(this.getDepPhone(), rhs.getDepPhone())
486             .append(this.getDepLdapPresent(), rhs.getDepLdapPresent())
487             .append(this.getDepCreationDt(), rhs.getDepCreationDt())
488             .append(this.getUpdateDt(), rhs.getUpdateDt())
489             .append(this.getStatusCd(), rhs.getStatusCd())
490             .append(this.getParentDepartmentId(), rhs.getParentDepartmentId())
491             .append(this.getPrivileges(), rhs.getPrivileges())
492             .isEquals();
493     }
494 
495     /**
496      * @param object to compare this object against
497      * @return int if equal
498      * @see Comparable#compareTo(Object)
499      */
500     public int compareTo(final DepartmentVO object)
501     {
502         if (object==null)
503         {
504             return -1;
505         }
506         // Check if the same object instance
507         if (object==this)
508         {
509             return 0;
510         }
511         return new CompareToBuilder()
512             .append(this.getDepId(), object.getDepId())
513             .append(this.getDepCd(), object.getDepCd())
514             .append(this.getDepNm(), object.getDepNm())
515             .append(this.getDepDc(), object.getDepDc())
516             .append(this.getDepEMail(), object.getDepEMail())
517             .append(this.getDepAddress(), object.getDepAddress())
518             .append(this.getDepPhone(), object.getDepPhone())
519             .append(this.getDepLdapPresent(), object.getDepLdapPresent())
520             .append(this.getDepCreationDt(), object.getDepCreationDt())
521             .append(this.getUpdateDt(), object.getUpdateDt())
522             .append(this.getStatusCd(), object.getStatusCd())
523             .append(this.getParentDepartmentId(), object.getParentDepartmentId())
524             .append(this.getPrivileges(), object.getPrivileges())
525             .toComparison();
526     }
527 
528     /**
529      * @return int hashCode value
530      * @see Object#hashCode()
531      */
532     @Override
533     public int hashCode()
534     {
535         return new HashCodeBuilder(1249046965, -82296885)
536             .append(this.getDepId())
537             .append(this.getDepCd())
538             .append(this.getDepNm())
539             .append(this.getDepDc())
540             .append(this.getDepEMail())
541             .append(this.getDepAddress())
542             .append(this.getDepPhone())
543             .append(this.getDepLdapPresent())
544             .append(this.getDepCreationDt())
545             .append(this.getUpdateDt())
546             .append(this.getStatusCd())
547             .append(this.getParentDepartmentId())
548             //Commented out to avoid commons-lang-2.4 recursion StackOverflowError: https://issues.apache.org/jira/browse/LANG-456
549             //.append(this.getPrivileges())
550             .toHashCode();
551     }
552 
553     /**
554      * @return String representation of object
555      * @see Object#toString()
556      */
557     @Override
558     public String toString()
559     {
560         return new ToStringBuilder(this)
561             .append("depId", this.getDepId())
562             .append("depCd", this.getDepCd())
563             .append("depNm", this.getDepNm())
564             .append("depDc", this.getDepDc())
565             .append("depEMail", this.getDepEMail())
566             .append("depAddress", this.getDepAddress())
567             .append("depPhone", this.getDepPhone())
568             .append("depLdapPresent", this.getDepLdapPresent())
569             .append("depCreationDt", this.getDepCreationDt())
570             .append("updateDt", this.getUpdateDt())
571             .append("statusCd", this.getStatusCd())
572             .append("parentDepartmentId", this.getParentDepartmentId())
573             .append("privileges", this.getPrivileges())
574             .toString();
575     }
576 
577     /**
578      * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
579      * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
580      * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
581      *
582      * <p/>Note that for array, collection or map instances the comparison runs one level deep.
583      *
584      * @param first the first object to compare, may be {@code null}
585      * @param second the second object to compare, may be {@code null}
586      * @return this method will return {@code true} in case both objects are equal as explained above;
587      *      in all other cases this method will return {@code false}
588      */
589     protected static boolean equal(final Object first, final Object second)
590     {
591         final boolean equal;
592 
593         if (first == null)
594         {
595             equal = (second == null);
596         }
597         else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
598         {
599             equal = Arrays.equals((Object[])first, (Object[])second);
600         }
601         else // note that the following also covers java.util.Collection and java.util.Map
602         {
603             equal = first.equals(second);
604         }
605 
606         return equal;
607     }
608 
609     // DepartmentVO value-object java merge-point
610 }