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