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