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