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::strategy::StrategyVO
27   * STEREOTYPE:   ValueObject
28   */
29  package fr.ifremer.quadrige3.core.vo.administration.strategy;
30  
31  import fr.ifremer.quadrige3.core.vo.administration.program.ProgramVO;
32  import java.io.Serializable;
33  import java.sql.Timestamp;
34  import java.util.Arrays;
35  import java.util.Date;
36  import org.apache.commons.lang3.builder.CompareToBuilder;
37  import org.apache.commons.lang3.builder.EqualsBuilder;
38  import org.apache.commons.lang3.builder.HashCodeBuilder;
39  import org.apache.commons.lang3.builder.ToStringBuilder;
40  
41  /**
42   * Définie les paramètres à mesurer dans un programme particulier.
43   */
44  public class StrategyVO
45      implements Serializable, Comparable<StrategyVO>
46  {
47      /** The serial version UID of this class. Needed for serialization. */
48      private static final long serialVersionUID = -689132129716129621L;
49  
50      // Class attributes
51      /**
52       * Identifiant interne de la stratégie
53       */
54      protected Integer stratId;
55      /**
56       * Libellé de la stratégie
57       */
58      protected String stratNm;
59      /**
60       * Description de la stratégie (de type commentaire car taille insuffisante)
61       */
62      protected String stratDc;
63      /**
64       * Date de création de l'objet
65       */
66      protected Date stratCreationDt;
67      /**
68       * Date de mise à jour de l'objet
69       */
70      protected Timestamp updateDt;
71      /** TODO: Model Documentation for attribute statusCd */
72      protected String statusCd;
73      /** TODO: Model Documentation for attribute progCd */
74      protected String progCd;
75      /** TODO: Model Documentation for attribute respDepIds */
76      protected Integer[] respDepIds;
77      /** TODO: Model Documentation for attribute respQuserIds */
78      protected Integer[] respQuserIds;
79  
80      // Class associationEnds
81      /**
82       * Activités à l'origine de la collecte d'un ensemble cohérent de données.
83       */
84      protected ProgramVO programVO;
85  
86      /**
87       * Identifie les conditions d'application locale de la stratégie pour une période donnée.
88       */
89      protected AppliedStrategyVO[] appliedStrategyVOs;
90  
91      /**
92       * PSFM associés à une stratégie
93       * PMSF associés à une stratégie.
94       */
95      protected PmfmStrategyVO[] pmfmStrategyVOs;
96  
97      /** Default Constructor with no properties */
98      public StrategyVO()
99      {
100         // Documented empty block - avoid compiler warning - no super constructor
101     }
102 
103     /**
104      * Constructor taking only required properties
105      * @param stratIdIn Integer Identifiant interne de la stratégie
106      * @param stratNmIn String Libellé de la stratégie
107      * @param statusCdIn String
108      * @param progCdIn String
109      * @param respDepIdsIn Integer[]
110      * @param respQuserIdsIn Integer[]
111      * @param programVOIn ProgramVO Activités à l'origine de la collecte d'un ensemble cohérent de données.
112      */
113     public StrategyVO(final Integer stratIdIn, final String stratNmIn, final String statusCdIn, final String progCdIn, final Integer[] respDepIdsIn, final Integer[] respQuserIdsIn, final ProgramVO programVOIn)
114     {
115         this.stratId = stratIdIn;
116         this.stratNm = stratNmIn;
117         this.statusCd = statusCdIn;
118         this.progCd = progCdIn;
119         this.respDepIds = respDepIdsIn;
120         this.respQuserIds = respQuserIdsIn;
121         this.programVO = programVOIn;
122     }
123 
124     /**
125      * Constructor with all properties
126      * @param stratIdIn Integer
127      * @param stratNmIn String
128      * @param stratDcIn String
129      * @param stratCreationDtIn Date
130      * @param updateDtIn Timestamp
131      * @param statusCdIn String
132      * @param progCdIn String
133      * @param respDepIdsIn Integer[]
134      * @param respQuserIdsIn Integer[]
135      * @param programVOIn ProgramVO
136      * @param appliedStrategyVOsIn AppliedStrategyVO[]
137      * @param pmfmStrategyVOsIn PmfmStrategyVO[]
138      */
139     public StrategyVO(final Integer stratIdIn, final String stratNmIn, final String stratDcIn, final Date stratCreationDtIn, final Timestamp updateDtIn, final String statusCdIn, final String progCdIn, final Integer[] respDepIdsIn, final Integer[] respQuserIdsIn, final ProgramVO programVOIn, final AppliedStrategyVO[] appliedStrategyVOsIn, final PmfmStrategyVO[] pmfmStrategyVOsIn)
140     {
141         this.stratId = stratIdIn;
142         this.stratNm = stratNmIn;
143         this.stratDc = stratDcIn;
144         this.stratCreationDt = stratCreationDtIn;
145         this.updateDt = updateDtIn;
146         this.statusCd = statusCdIn;
147         this.progCd = progCdIn;
148         this.respDepIds = respDepIdsIn;
149         this.respQuserIds = respQuserIdsIn;
150         this.programVO = programVOIn;
151         this.appliedStrategyVOs = appliedStrategyVOsIn;
152         this.pmfmStrategyVOs = pmfmStrategyVOsIn;
153     }
154 
155     /**
156      * Copies constructor from other StrategyVO
157      *
158      * @param otherBean Cannot be <code>null</code>
159      * @throws NullPointerException if the argument is <code>null</code>
160      */
161     public StrategyVO(final StrategyVO otherBean)
162     {
163         this.stratId = otherBean.getStratId();
164         this.stratNm = otherBean.getStratNm();
165         this.stratDc = otherBean.getStratDc();
166         this.stratCreationDt = otherBean.getStratCreationDt();
167         this.updateDt = otherBean.getUpdateDt();
168         this.statusCd = otherBean.getStatusCd();
169         this.progCd = otherBean.getProgCd();
170         this.respDepIds = otherBean.getRespDepIds();
171         this.respQuserIds = otherBean.getRespQuserIds();
172         this.programVO = otherBean.getProgramVO();
173         this.appliedStrategyVOs = otherBean.getAppliedStrategyVOs();
174         this.pmfmStrategyVOs = otherBean.getPmfmStrategyVOs();
175     }
176 
177     /**
178      * Copies all properties from the argument value object into this value object.
179      * @param otherBean Cannot be <code>null</code>
180      */
181     public void copy(final StrategyVO otherBean)
182     {
183         if (null != otherBean)
184         {
185             this.setStratId(otherBean.getStratId());
186             this.setStratNm(otherBean.getStratNm());
187             this.setStratDc(otherBean.getStratDc());
188             this.setStratCreationDt(otherBean.getStratCreationDt());
189             this.setUpdateDt(otherBean.getUpdateDt());
190             this.setStatusCd(otherBean.getStatusCd());
191             this.setProgCd(otherBean.getProgCd());
192             this.setRespDepIds(otherBean.getRespDepIds());
193             this.setRespQuserIds(otherBean.getRespQuserIds());
194             this.setProgramVO(otherBean.getProgramVO());
195             this.setAppliedStrategyVOs(otherBean.getAppliedStrategyVOs());
196             this.setPmfmStrategyVOs(otherBean.getPmfmStrategyVOs());
197         }
198     }
199 
200     /**
201      * Identifiant interne de la stratégie
202      * Get the stratId Attribute
203      * @return stratId Integer
204      */
205     public Integer getStratId()
206     {
207         return this.stratId;
208     }
209 
210     /**
211      * Identifiant interne de la stratégie
212      * @param value Integer
213      */
214     public void setStratId(final Integer value)
215     {
216         this.stratId = value;
217     }
218 
219     /**
220      * Libellé de la stratégie
221      * Get the stratNm Attribute
222      * @return stratNm String
223      */
224     public String getStratNm()
225     {
226         return this.stratNm;
227     }
228 
229     /**
230      * Libellé de la stratégie
231      * @param value String
232      */
233     public void setStratNm(final String value)
234     {
235         this.stratNm = value;
236     }
237 
238     /**
239      * Description de la stratégie (de type commentaire car taille insuffisante)
240      * Get the stratDc Attribute
241      * @return stratDc String
242      */
243     public String getStratDc()
244     {
245         return this.stratDc;
246     }
247 
248     /**
249      * Description de la stratégie (de type commentaire car taille insuffisante)
250      * @param value String
251      */
252     public void setStratDc(final String value)
253     {
254         this.stratDc = value;
255     }
256 
257     /**
258      * Date de création de l'objet
259      * Get the stratCreationDt Attribute
260      * @return stratCreationDt Date
261      */
262     public Date getStratCreationDt()
263     {
264         return this.stratCreationDt;
265     }
266 
267     /**
268      * Date de création de l'objet
269      * @param value Date
270      */
271     public void setStratCreationDt(final Date value)
272     {
273         this.stratCreationDt = value;
274     }
275 
276     /**
277      * Date de mise à jour de l'objet
278      * Get the updateDt Attribute
279      * @return updateDt Timestamp
280      */
281     public Timestamp getUpdateDt()
282     {
283         return this.updateDt;
284     }
285 
286     /**
287      * Date de mise à jour de l'objet
288      * @param value Timestamp
289      */
290     public void setUpdateDt(final Timestamp value)
291     {
292         this.updateDt = value;
293     }
294 
295     /**
296      * TODO: Model Documentation for attribute statusCd
297      * Get the statusCd Attribute
298      * @return statusCd String
299      */
300     public String getStatusCd()
301     {
302         return this.statusCd;
303     }
304 
305     /**
306      * 
307      * @param value String
308      */
309     public void setStatusCd(final String value)
310     {
311         this.statusCd = value;
312     }
313 
314     /**
315      * TODO: Model Documentation for attribute progCd
316      * Get the progCd Attribute
317      * @return progCd String
318      */
319     public String getProgCd()
320     {
321         return this.progCd;
322     }
323 
324     /**
325      * 
326      * @param value String
327      */
328     public void setProgCd(final String value)
329     {
330         this.progCd = value;
331     }
332 
333     /**
334      * TODO: Model Documentation for attribute respDepIds
335      * Get the respDepIds Attribute
336      * @return respDepIds Integer[]
337      */
338     public Integer[] getRespDepIds()
339     {
340         return this.respDepIds;
341     }
342 
343     /**
344      * 
345      * @param value Integer[]
346      */
347     public void setRespDepIds(final Integer[] value)
348     {
349         this.respDepIds = value;
350     }
351 
352     /**
353      * TODO: Model Documentation for attribute respQuserIds
354      * Get the respQuserIds Attribute
355      * @return respQuserIds Integer[]
356      */
357     public Integer[] getRespQuserIds()
358     {
359         return this.respQuserIds;
360     }
361 
362     /**
363      * 
364      * @param value Integer[]
365      */
366     public void setRespQuserIds(final Integer[] value)
367     {
368         this.respQuserIds = value;
369     }
370 
371     /**
372      * Activités à l'origine de la collecte d'un ensemble cohérent de données.
373      * Get the programVO Association
374      * @return this.programVO ProgramVO
375      */
376     public ProgramVO getProgramVO()
377     {
378         return this.programVO;
379     }
380 
381     /**
382      * Sets the programVO
383      * @param value ProgramVO
384      */
385     public void setProgramVO(ProgramVO value)
386     {
387         this.programVO = value;
388     }
389 
390     /**
391      * Identifie les conditions d'application locale de la stratégie pour une période donnée.
392      * Get the appliedStrategyVOs Association
393      * This accessor method returns a reference to the live list,
394      * not a snapshot. Therefore any modification you make to the
395      * returned list will be present inside the object.
396      * @return this.appliedStrategyVOs AppliedStrategyVO[]
397      */
398     public AppliedStrategyVO[] getAppliedStrategyVOs()
399     {
400         return this.appliedStrategyVOs;
401     }
402 
403     /**
404      * Sets the appliedStrategyVOs
405      * @param value AppliedStrategyVO[]
406      */
407     public void setAppliedStrategyVOs(AppliedStrategyVO[] value)
408     {
409         this.appliedStrategyVOs = value;
410     }
411 
412     /**
413      * PSFM associés à une stratégie
414      * PMSF associés à une stratégie.
415      * Get the pmfmStrategyVOs Association
416      * This accessor method returns a reference to the live list,
417      * not a snapshot. Therefore any modification you make to the
418      * returned list will be present inside the object.
419      * @return this.pmfmStrategyVOs PmfmStrategyVO[]
420      */
421     public PmfmStrategyVO[] getPmfmStrategyVOs()
422     {
423         return this.pmfmStrategyVOs;
424     }
425 
426     /**
427      * Sets the pmfmStrategyVOs
428      * @param value PmfmStrategyVO[]
429      */
430     public void setPmfmStrategyVOs(PmfmStrategyVO[] value)
431     {
432         this.pmfmStrategyVOs = value;
433     }
434 
435     /**
436      * @param object to compare this object against
437      * @return boolean if equal
438      * @see Object#equals(Object)
439      */
440     @Override
441     public boolean equals(final Object object)
442     {
443         if (object==null || object.getClass() != this.getClass())
444         {
445              return false;
446         }
447         // Check if the same object instance
448         if (object==this)
449         {
450             return true;
451         }
452         StrategyVO rhs = (StrategyVO) object;
453         return new EqualsBuilder()
454             .append(this.getStratId(), rhs.getStratId())
455             .append(this.getStratNm(), rhs.getStratNm())
456             .append(this.getStratDc(), rhs.getStratDc())
457             .append(this.getStratCreationDt(), rhs.getStratCreationDt())
458             .append(this.getUpdateDt(), rhs.getUpdateDt())
459             .append(this.getStatusCd(), rhs.getStatusCd())
460             .append(this.getProgCd(), rhs.getProgCd())
461             .append(this.getRespDepIds(), rhs.getRespDepIds())
462             .append(this.getRespQuserIds(), rhs.getRespQuserIds())
463             .append(this.getProgramVO(), rhs.getProgramVO())
464             .append(this.getAppliedStrategyVOs(), rhs.getAppliedStrategyVOs())
465             .append(this.getPmfmStrategyVOs(), rhs.getPmfmStrategyVOs())
466             .isEquals();
467     }
468 
469     /**
470      * @param object to compare this object against
471      * @return int if equal
472      * @see Comparable#compareTo(Object)
473      */
474     public int compareTo(final StrategyVO object)
475     {
476         if (object==null)
477         {
478             return -1;
479         }
480         // Check if the same object instance
481         if (object==this)
482         {
483             return 0;
484         }
485         return new CompareToBuilder()
486             .append(this.getStratId(), object.getStratId())
487             .append(this.getStratNm(), object.getStratNm())
488             .append(this.getStratDc(), object.getStratDc())
489             .append(this.getStratCreationDt(), object.getStratCreationDt())
490             .append(this.getUpdateDt(), object.getUpdateDt())
491             .append(this.getStatusCd(), object.getStatusCd())
492             .append(this.getProgCd(), object.getProgCd())
493             .append(this.getRespDepIds(), object.getRespDepIds())
494             .append(this.getRespQuserIds(), object.getRespQuserIds())
495             .append(this.getProgramVO(), object.getProgramVO())
496             .append(this.getAppliedStrategyVOs(), object.getAppliedStrategyVOs())
497             .append(this.getPmfmStrategyVOs(), object.getPmfmStrategyVOs())
498             .toComparison();
499     }
500 
501     /**
502      * @return int hashCode value
503      * @see Object#hashCode()
504      */
505     @Override
506     public int hashCode()
507     {
508         return new HashCodeBuilder(1249046965, -82296885)
509             .append(this.getStratId())
510             .append(this.getStratNm())
511             .append(this.getStratDc())
512             .append(this.getStratCreationDt())
513             .append(this.getUpdateDt())
514             .append(this.getStatusCd())
515             .append(this.getProgCd())
516             .append(this.getRespDepIds())
517             .append(this.getRespQuserIds())
518             .append(this.getProgramVO())
519             //Commented out to avoid commons-lang-2.4 recursion StackOverflowError: https://issues.apache.org/jira/browse/LANG-456
520             //.append(this.getAppliedStrategyVOs())
521             //Commented out to avoid commons-lang-2.4 recursion StackOverflowError: https://issues.apache.org/jira/browse/LANG-456
522             //.append(this.getPmfmStrategyVOs())
523             .toHashCode();
524     }
525 
526     /**
527      * @return String representation of object
528      * @see Object#toString()
529      */
530     @Override
531     public String toString()
532     {
533         return new ToStringBuilder(this)
534             .append("stratId", this.getStratId())
535             .append("stratNm", this.getStratNm())
536             .append("stratDc", this.getStratDc())
537             .append("stratCreationDt", this.getStratCreationDt())
538             .append("updateDt", this.getUpdateDt())
539             .append("statusCd", this.getStatusCd())
540             .append("progCd", this.getProgCd())
541             .append("respDepIds", this.getRespDepIds())
542             .append("respQuserIds", this.getRespQuserIds())
543             .append("programVO", this.getProgramVO())
544             .append("appliedStrategyVOs", this.getAppliedStrategyVOs())
545             .append("pmfmStrategyVOs", this.getPmfmStrategyVOs())
546             .toString();
547     }
548 
549     /**
550      * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
551      * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
552      * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
553      *
554      * <p/>Note that for array, collection or map instances the comparison runs one level deep.
555      *
556      * @param first the first object to compare, may be {@code null}
557      * @param second the second object to compare, may be {@code null}
558      * @return this method will return {@code true} in case both objects are equal as explained above;
559      *      in all other cases this method will return {@code false}
560      */
561     protected static boolean equal(final Object first, final Object second)
562     {
563         final boolean equal;
564 
565         if (first == null)
566         {
567             equal = (second == null);
568         }
569         else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
570         {
571             equal = Arrays.equals((Object[])first, (Object[])second);
572         }
573         else // note that the following also covers java.util.Collection and java.util.Map
574         {
575             equal = first.equals(second);
576         }
577 
578         return equal;
579     }
580 
581     // StrategyVO value-object java merge-point
582 }