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::PmfmAppliedStrategyVO
27 * STEREOTYPE: ValueObject
28 */
29 package fr.ifremer.quadrige3.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 * PMSF associés à une stratégie pour un lieu données.
41 */
42 public class PmfmAppliedStrategyVO
43 implements Serializable, Comparable<PmfmAppliedStrategyVO>
44 {
45 /** The serial version UID of this class. Needed for serialization. */
46 private static final long serialVersionUID = -5760269556011704032L;
47
48 // Class attributes
49 /**
50 * Date de modification de l'objet, mise à jour par le système
51 */
52 protected Timestamp updateDt;
53 /**
54 * Identifiant de l'engin
55 */
56 protected Integer analInstId;
57 /**
58 * Identifiant interne d'un service
59 */
60 protected Integer depId;
61 /** TODO: Model Documentation for attribute appliedStratId */
62 protected Integer appliedStratId;
63 /** TODO: Model Documentation for attribute pmfmStratId */
64 protected Integer pmfmStratId;
65
66 // Class associationEnds
67 /**
68 * Identifie les conditions d'application locale de la stratégie pour une période donnée.
69 */
70 protected AppliedStrategyVO appliedStrategyVO;
71
72 /**
73 * PSFM associés à une stratégie
74 * PMSF associés à une stratégie.
75 */
76 protected PmfmStrategyVO pmfmStrategyVO;
77
78 /** Default Constructor with no properties */
79 public PmfmAppliedStrategyVO()
80 {
81 // Documented empty block - avoid compiler warning - no super constructor
82 }
83
84 /**
85 * Constructor taking only required properties
86 * @param appliedStratIdIn Integer
87 * @param pmfmStratIdIn Integer
88 * @param appliedStrategyVOIn AppliedStrategyVO Identifie les conditions d'application locale de la stratégie pour une période donnée.
89 * @param pmfmStrategyVOIn PmfmStrategyVO PSFM associés à une stratégie
90 PMSF associés à une stratégie.
91 */
92 public PmfmAppliedStrategyVO(final Integer appliedStratIdIn, final Integer pmfmStratIdIn, final AppliedStrategyVO appliedStrategyVOIn, final PmfmStrategyVO pmfmStrategyVOIn)
93 {
94 this.appliedStratId = appliedStratIdIn;
95 this.pmfmStratId = pmfmStratIdIn;
96 this.appliedStrategyVO = appliedStrategyVOIn;
97 this.pmfmStrategyVO = pmfmStrategyVOIn;
98 }
99
100 /**
101 * Constructor with all properties
102 * @param updateDtIn Timestamp
103 * @param analInstIdIn Integer
104 * @param depIdIn Integer
105 * @param appliedStratIdIn Integer
106 * @param pmfmStratIdIn Integer
107 * @param appliedStrategyVOIn AppliedStrategyVO
108 * @param pmfmStrategyVOIn PmfmStrategyVO
109 */
110 public PmfmAppliedStrategyVO(final Timestamp updateDtIn, final Integer analInstIdIn, final Integer depIdIn, final Integer appliedStratIdIn, final Integer pmfmStratIdIn, final AppliedStrategyVO appliedStrategyVOIn, final PmfmStrategyVO pmfmStrategyVOIn)
111 {
112 this.updateDt = updateDtIn;
113 this.analInstId = analInstIdIn;
114 this.depId = depIdIn;
115 this.appliedStratId = appliedStratIdIn;
116 this.pmfmStratId = pmfmStratIdIn;
117 this.appliedStrategyVO = appliedStrategyVOIn;
118 this.pmfmStrategyVO = pmfmStrategyVOIn;
119 }
120
121 /**
122 * Copies constructor from other PmfmAppliedStrategyVO
123 *
124 * @param otherBean Cannot be <code>null</code>
125 * @throws NullPointerException if the argument is <code>null</code>
126 */
127 public PmfmAppliedStrategyVO(final PmfmAppliedStrategyVO otherBean)
128 {
129 this.updateDt = otherBean.getUpdateDt();
130 this.analInstId = otherBean.getAnalInstId();
131 this.depId = otherBean.getDepId();
132 this.appliedStratId = otherBean.getAppliedStratId();
133 this.pmfmStratId = otherBean.getPmfmStratId();
134 this.appliedStrategyVO = otherBean.getAppliedStrategyVO();
135 this.pmfmStrategyVO = otherBean.getPmfmStrategyVO();
136 }
137
138 /**
139 * Copies all properties from the argument value object into this value object.
140 * @param otherBean Cannot be <code>null</code>
141 */
142 public void copy(final PmfmAppliedStrategyVO otherBean)
143 {
144 if (null != otherBean)
145 {
146 this.setUpdateDt(otherBean.getUpdateDt());
147 this.setAnalInstId(otherBean.getAnalInstId());
148 this.setDepId(otherBean.getDepId());
149 this.setAppliedStratId(otherBean.getAppliedStratId());
150 this.setPmfmStratId(otherBean.getPmfmStratId());
151 this.setAppliedStrategyVO(otherBean.getAppliedStrategyVO());
152 this.setPmfmStrategyVO(otherBean.getPmfmStrategyVO());
153 }
154 }
155
156 /**
157 * Date de modification de l'objet, mise à jour par le système
158 * Get the updateDt Attribute
159 * @return updateDt Timestamp
160 */
161 public Timestamp getUpdateDt()
162 {
163 return this.updateDt;
164 }
165
166 /**
167 * Date de modification de l'objet, mise à jour par le système
168 * @param value Timestamp
169 */
170 public void setUpdateDt(final Timestamp value)
171 {
172 this.updateDt = value;
173 }
174
175 /**
176 * Identifiant de l'engin
177 * Get the analInstId Attribute
178 * @return analInstId Integer
179 */
180 public Integer getAnalInstId()
181 {
182 return this.analInstId;
183 }
184
185 /**
186 * Identifiant de l'engin
187 * @param value Integer
188 */
189 public void setAnalInstId(final Integer value)
190 {
191 this.analInstId = value;
192 }
193
194 /**
195 * Identifiant interne d'un service
196 * Get the depId Attribute
197 * @return depId Integer
198 */
199 public Integer getDepId()
200 {
201 return this.depId;
202 }
203
204 /**
205 * Identifiant interne d'un service
206 * @param value Integer
207 */
208 public void setDepId(final Integer value)
209 {
210 this.depId = value;
211 }
212
213 /**
214 * TODO: Model Documentation for attribute appliedStratId
215 * Get the appliedStratId Attribute
216 * @return appliedStratId Integer
217 */
218 public Integer getAppliedStratId()
219 {
220 return this.appliedStratId;
221 }
222
223 /**
224 *
225 * @param value Integer
226 */
227 public void setAppliedStratId(final Integer value)
228 {
229 this.appliedStratId = value;
230 }
231
232 /**
233 * TODO: Model Documentation for attribute pmfmStratId
234 * Get the pmfmStratId Attribute
235 * @return pmfmStratId Integer
236 */
237 public Integer getPmfmStratId()
238 {
239 return this.pmfmStratId;
240 }
241
242 /**
243 *
244 * @param value Integer
245 */
246 public void setPmfmStratId(final Integer value)
247 {
248 this.pmfmStratId = value;
249 }
250
251 /**
252 * Identifie les conditions d'application locale de la stratégie pour une période donnée.
253 * Get the appliedStrategyVO Association
254 * @return this.appliedStrategyVO AppliedStrategyVO
255 */
256 public AppliedStrategyVO getAppliedStrategyVO()
257 {
258 return this.appliedStrategyVO;
259 }
260
261 /**
262 * Sets the appliedStrategyVO
263 * @param value AppliedStrategyVO
264 */
265 public void setAppliedStrategyVO(AppliedStrategyVO value)
266 {
267 this.appliedStrategyVO = value;
268 }
269
270 /**
271 * PSFM associés à une stratégie
272 * PMSF associés à une stratégie.
273 * Get the pmfmStrategyVO Association
274 * @return this.pmfmStrategyVO PmfmStrategyVO
275 */
276 public PmfmStrategyVO getPmfmStrategyVO()
277 {
278 return this.pmfmStrategyVO;
279 }
280
281 /**
282 * Sets the pmfmStrategyVO
283 * @param value PmfmStrategyVO
284 */
285 public void setPmfmStrategyVO(PmfmStrategyVO value)
286 {
287 this.pmfmStrategyVO = value;
288 }
289
290 /**
291 * @param object to compare this object against
292 * @return boolean if equal
293 * @see Object#equals(Object)
294 */
295 @Override
296 public boolean equals(final Object object)
297 {
298 if (object==null || object.getClass() != this.getClass())
299 {
300 return false;
301 }
302 // Check if the same object instance
303 if (object==this)
304 {
305 return true;
306 }
307 PmfmAppliedStrategyVO rhs = (PmfmAppliedStrategyVO) object;
308 return new EqualsBuilder()
309 .append(this.getUpdateDt(), rhs.getUpdateDt())
310 .append(this.getAnalInstId(), rhs.getAnalInstId())
311 .append(this.getDepId(), rhs.getDepId())
312 .append(this.getAppliedStratId(), rhs.getAppliedStratId())
313 .append(this.getPmfmStratId(), rhs.getPmfmStratId())
314 .append(this.getAppliedStrategyVO(), rhs.getAppliedStrategyVO())
315 .append(this.getPmfmStrategyVO(), rhs.getPmfmStrategyVO())
316 .isEquals();
317 }
318
319 /**
320 * @param object to compare this object against
321 * @return int if equal
322 * @see Comparable#compareTo(Object)
323 */
324 public int compareTo(final PmfmAppliedStrategyVO object)
325 {
326 if (object==null)
327 {
328 return -1;
329 }
330 // Check if the same object instance
331 if (object==this)
332 {
333 return 0;
334 }
335 return new CompareToBuilder()
336 .append(this.getUpdateDt(), object.getUpdateDt())
337 .append(this.getAnalInstId(), object.getAnalInstId())
338 .append(this.getDepId(), object.getDepId())
339 .append(this.getAppliedStratId(), object.getAppliedStratId())
340 .append(this.getPmfmStratId(), object.getPmfmStratId())
341 .append(this.getAppliedStrategyVO(), object.getAppliedStrategyVO())
342 .append(this.getPmfmStrategyVO(), object.getPmfmStrategyVO())
343 .toComparison();
344 }
345
346 /**
347 * @return int hashCode value
348 * @see Object#hashCode()
349 */
350 @Override
351 public int hashCode()
352 {
353 return new HashCodeBuilder(1249046965, -82296885)
354 .append(this.getUpdateDt())
355 .append(this.getAnalInstId())
356 .append(this.getDepId())
357 .append(this.getAppliedStratId())
358 .append(this.getPmfmStratId())
359 .append(this.getAppliedStrategyVO())
360 .append(this.getPmfmStrategyVO())
361 .toHashCode();
362 }
363
364 /**
365 * @return String representation of object
366 * @see Object#toString()
367 */
368 @Override
369 public String toString()
370 {
371 return new ToStringBuilder(this)
372 .append("updateDt", this.getUpdateDt())
373 .append("analInstId", this.getAnalInstId())
374 .append("depId", this.getDepId())
375 .append("appliedStratId", this.getAppliedStratId())
376 .append("pmfmStratId", this.getPmfmStratId())
377 .append("appliedStrategyVO", this.getAppliedStrategyVO())
378 .append("pmfmStrategyVO", this.getPmfmStrategyVO())
379 .toString();
380 }
381
382 /**
383 * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
384 * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
385 * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
386 *
387 * <p/>Note that for array, collection or map instances the comparison runs one level deep.
388 *
389 * @param first the first object to compare, may be {@code null}
390 * @param second the second object to compare, may be {@code null}
391 * @return this method will return {@code true} in case both objects are equal as explained above;
392 * in all other cases this method will return {@code false}
393 */
394 protected static boolean equal(final Object first, final Object second)
395 {
396 final boolean equal;
397
398 if (first == null)
399 {
400 equal = (second == null);
401 }
402 else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
403 {
404 equal = Arrays.equals((Object[])first, (Object[])second);
405 }
406 else // note that the following also covers java.util.Collection and java.util.Map
407 {
408 equal = first.equals(second);
409 }
410
411 return equal;
412 }
413
414 // PmfmAppliedStrategyVO value-object java merge-point
415 }