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::system::rule::RulePmfmVO
27 * STEREOTYPE: ValueObject
28 */
29 package fr.ifremer.quadrige3.core.vo.system.rule;
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 * TODO: Model Documentation for class RulePmfmVO
41 */
42 public class RulePmfmVO
43 implements Serializable, Comparable<RulePmfmVO>
44 {
45 /** The serial version UID of this class. Needed for serialization. */
46 private static final long serialVersionUID = 2726347859412290728L;
47
48 // Class attributes
49 /** TODO: Model Documentation for attribute rulePmfmId */
50 protected Integer rulePmfmId;
51 /** TODO: Model Documentation for attribute updateDt */
52 protected Timestamp updateDt;
53 /** TODO: Model Documentation for attribute ruleCd */
54 protected String ruleCd;
55 /** TODO: Model Documentation for attribute parCd */
56 protected String parCd;
57 /** TODO: Model Documentation for attribute matrixId */
58 protected Integer matrixId;
59 /** TODO: Model Documentation for attribute fractionId */
60 protected Integer fractionId;
61 /** TODO: Model Documentation for attribute methodId */
62 protected Integer methodId;
63 /** TODO: Model Documentation for attribute unitId */
64 protected Integer unitId;
65
66 // Class associationEnds
67 /** TODO: Model Documentation for attribute ruleVO */
68 protected RuleVO ruleVO;
69
70 /** Default Constructor with no properties */
71 public RulePmfmVO()
72 {
73 // Documented empty block - avoid compiler warning - no super constructor
74 }
75
76 /**
77 * Constructor taking only required properties
78 * @param rulePmfmIdIn Integer
79 * @param ruleCdIn String
80 * @param parCdIn String
81 * @param ruleVOIn RuleVO
82 */
83 public RulePmfmVO(final Integer rulePmfmIdIn, final String ruleCdIn, final String parCdIn, final RuleVO ruleVOIn)
84 {
85 this.rulePmfmId = rulePmfmIdIn;
86 this.ruleCd = ruleCdIn;
87 this.parCd = parCdIn;
88 this.ruleVO = ruleVOIn;
89 }
90
91 /**
92 * Constructor with all properties
93 * @param rulePmfmIdIn Integer
94 * @param updateDtIn Timestamp
95 * @param ruleCdIn String
96 * @param parCdIn String
97 * @param matrixIdIn Integer
98 * @param fractionIdIn Integer
99 * @param methodIdIn Integer
100 * @param unitIdIn Integer
101 * @param ruleVOIn RuleVO
102 */
103 public RulePmfmVO(final Integer rulePmfmIdIn, final Timestamp updateDtIn, final String ruleCdIn, final String parCdIn, final Integer matrixIdIn, final Integer fractionIdIn, final Integer methodIdIn, final Integer unitIdIn, final RuleVO ruleVOIn)
104 {
105 this.rulePmfmId = rulePmfmIdIn;
106 this.updateDt = updateDtIn;
107 this.ruleCd = ruleCdIn;
108 this.parCd = parCdIn;
109 this.matrixId = matrixIdIn;
110 this.fractionId = fractionIdIn;
111 this.methodId = methodIdIn;
112 this.unitId = unitIdIn;
113 this.ruleVO = ruleVOIn;
114 }
115
116 /**
117 * Copies constructor from other RulePmfmVO
118 *
119 * @param otherBean Cannot be <code>null</code>
120 * @throws NullPointerException if the argument is <code>null</code>
121 */
122 public RulePmfmVO(final RulePmfmVO otherBean)
123 {
124 this.rulePmfmId = otherBean.getRulePmfmId();
125 this.updateDt = otherBean.getUpdateDt();
126 this.ruleCd = otherBean.getRuleCd();
127 this.parCd = otherBean.getParCd();
128 this.matrixId = otherBean.getMatrixId();
129 this.fractionId = otherBean.getFractionId();
130 this.methodId = otherBean.getMethodId();
131 this.unitId = otherBean.getUnitId();
132 this.ruleVO = otherBean.getRuleVO();
133 }
134
135 /**
136 * Copies all properties from the argument value object into this value object.
137 * @param otherBean Cannot be <code>null</code>
138 */
139 public void copy(final RulePmfmVO otherBean)
140 {
141 if (null != otherBean)
142 {
143 this.setRulePmfmId(otherBean.getRulePmfmId());
144 this.setUpdateDt(otherBean.getUpdateDt());
145 this.setRuleCd(otherBean.getRuleCd());
146 this.setParCd(otherBean.getParCd());
147 this.setMatrixId(otherBean.getMatrixId());
148 this.setFractionId(otherBean.getFractionId());
149 this.setMethodId(otherBean.getMethodId());
150 this.setUnitId(otherBean.getUnitId());
151 this.setRuleVO(otherBean.getRuleVO());
152 }
153 }
154
155 /**
156 * TODO: Model Documentation for attribute rulePmfmId
157 * Get the rulePmfmId Attribute
158 * @return rulePmfmId Integer
159 */
160 public Integer getRulePmfmId()
161 {
162 return this.rulePmfmId;
163 }
164
165 /**
166 *
167 * @param value Integer
168 */
169 public void setRulePmfmId(final Integer value)
170 {
171 this.rulePmfmId = value;
172 }
173
174 /**
175 * TODO: Model Documentation for attribute updateDt
176 * Get the updateDt Attribute
177 * @return updateDt Timestamp
178 */
179 public Timestamp getUpdateDt()
180 {
181 return this.updateDt;
182 }
183
184 /**
185 *
186 * @param value Timestamp
187 */
188 public void setUpdateDt(final Timestamp value)
189 {
190 this.updateDt = value;
191 }
192
193 /**
194 * TODO: Model Documentation for attribute ruleCd
195 * Get the ruleCd Attribute
196 * @return ruleCd String
197 */
198 public String getRuleCd()
199 {
200 return this.ruleCd;
201 }
202
203 /**
204 *
205 * @param value String
206 */
207 public void setRuleCd(final String value)
208 {
209 this.ruleCd = value;
210 }
211
212 /**
213 * TODO: Model Documentation for attribute parCd
214 * Get the parCd Attribute
215 * @return parCd String
216 */
217 public String getParCd()
218 {
219 return this.parCd;
220 }
221
222 /**
223 *
224 * @param value String
225 */
226 public void setParCd(final String value)
227 {
228 this.parCd = value;
229 }
230
231 /**
232 * TODO: Model Documentation for attribute matrixId
233 * Get the matrixId Attribute
234 * @return matrixId Integer
235 */
236 public Integer getMatrixId()
237 {
238 return this.matrixId;
239 }
240
241 /**
242 *
243 * @param value Integer
244 */
245 public void setMatrixId(final Integer value)
246 {
247 this.matrixId = value;
248 }
249
250 /**
251 * TODO: Model Documentation for attribute fractionId
252 * Get the fractionId Attribute
253 * @return fractionId Integer
254 */
255 public Integer getFractionId()
256 {
257 return this.fractionId;
258 }
259
260 /**
261 *
262 * @param value Integer
263 */
264 public void setFractionId(final Integer value)
265 {
266 this.fractionId = value;
267 }
268
269 /**
270 * TODO: Model Documentation for attribute methodId
271 * Get the methodId Attribute
272 * @return methodId Integer
273 */
274 public Integer getMethodId()
275 {
276 return this.methodId;
277 }
278
279 /**
280 *
281 * @param value Integer
282 */
283 public void setMethodId(final Integer value)
284 {
285 this.methodId = value;
286 }
287
288 /**
289 * TODO: Model Documentation for attribute unitId
290 * Get the unitId Attribute
291 * @return unitId Integer
292 */
293 public Integer getUnitId()
294 {
295 return this.unitId;
296 }
297
298 /**
299 *
300 * @param value Integer
301 */
302 public void setUnitId(final Integer value)
303 {
304 this.unitId = value;
305 }
306
307 /**
308 * TODO: Model Documentation for association ruleVO
309 * Get the ruleVO Association
310 * @return this.ruleVO RuleVO
311 */
312 public RuleVO getRuleVO()
313 {
314 return this.ruleVO;
315 }
316
317 /**
318 * Sets the ruleVO
319 * @param value RuleVO
320 */
321 public void setRuleVO(RuleVO value)
322 {
323 this.ruleVO = value;
324 }
325
326 /**
327 * @param object to compare this object against
328 * @return boolean if equal
329 * @see Object#equals(Object)
330 */
331 @Override
332 public boolean equals(final Object object)
333 {
334 if (object==null || object.getClass() != this.getClass())
335 {
336 return false;
337 }
338 // Check if the same object instance
339 if (object==this)
340 {
341 return true;
342 }
343 RulePmfmVO rhs = (RulePmfmVO) object;
344 return new EqualsBuilder()
345 .append(this.getRulePmfmId(), rhs.getRulePmfmId())
346 .append(this.getUpdateDt(), rhs.getUpdateDt())
347 .append(this.getRuleCd(), rhs.getRuleCd())
348 .append(this.getParCd(), rhs.getParCd())
349 .append(this.getMatrixId(), rhs.getMatrixId())
350 .append(this.getFractionId(), rhs.getFractionId())
351 .append(this.getMethodId(), rhs.getMethodId())
352 .append(this.getUnitId(), rhs.getUnitId())
353 .append(this.getRuleVO(), rhs.getRuleVO())
354 .isEquals();
355 }
356
357 /**
358 * @param object to compare this object against
359 * @return int if equal
360 * @see Comparable#compareTo(Object)
361 */
362 public int compareTo(final RulePmfmVO object)
363 {
364 if (object==null)
365 {
366 return -1;
367 }
368 // Check if the same object instance
369 if (object==this)
370 {
371 return 0;
372 }
373 return new CompareToBuilder()
374 .append(this.getRulePmfmId(), object.getRulePmfmId())
375 .append(this.getUpdateDt(), object.getUpdateDt())
376 .append(this.getRuleCd(), object.getRuleCd())
377 .append(this.getParCd(), object.getParCd())
378 .append(this.getMatrixId(), object.getMatrixId())
379 .append(this.getFractionId(), object.getFractionId())
380 .append(this.getMethodId(), object.getMethodId())
381 .append(this.getUnitId(), object.getUnitId())
382 .append(this.getRuleVO(), object.getRuleVO())
383 .toComparison();
384 }
385
386 /**
387 * @return int hashCode value
388 * @see Object#hashCode()
389 */
390 @Override
391 public int hashCode()
392 {
393 return new HashCodeBuilder(1249046965, -82296885)
394 .append(this.getRulePmfmId())
395 .append(this.getUpdateDt())
396 .append(this.getRuleCd())
397 .append(this.getParCd())
398 .append(this.getMatrixId())
399 .append(this.getFractionId())
400 .append(this.getMethodId())
401 .append(this.getUnitId())
402 .append(this.getRuleVO())
403 .toHashCode();
404 }
405
406 /**
407 * @return String representation of object
408 * @see Object#toString()
409 */
410 @Override
411 public String toString()
412 {
413 return new ToStringBuilder(this)
414 .append("rulePmfmId", this.getRulePmfmId())
415 .append("updateDt", this.getUpdateDt())
416 .append("ruleCd", this.getRuleCd())
417 .append("parCd", this.getParCd())
418 .append("matrixId", this.getMatrixId())
419 .append("fractionId", this.getFractionId())
420 .append("methodId", this.getMethodId())
421 .append("unitId", this.getUnitId())
422 .append("ruleVO", this.getRuleVO())
423 .toString();
424 }
425
426 /**
427 * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
428 * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
429 * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
430 *
431 * <p/>Note that for array, collection or map instances the comparison runs one level deep.
432 *
433 * @param first the first object to compare, may be {@code null}
434 * @param second the second object to compare, may be {@code null}
435 * @return this method will return {@code true} in case both objects are equal as explained above;
436 * in all other cases this method will return {@code false}
437 */
438 protected static boolean equal(final Object first, final Object second)
439 {
440 final boolean equal;
441
442 if (first == null)
443 {
444 equal = (second == null);
445 }
446 else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
447 {
448 equal = Arrays.equals((Object[])first, (Object[])second);
449 }
450 else // note that the following also covers java.util.Collection and java.util.Map
451 {
452 equal = first.equals(second);
453 }
454
455 return equal;
456 }
457
458 // RulePmfmVO value-object java merge-point
459 }