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::RuleParameterVO
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 RuleParameterVO
41 */
42 public class RuleParameterVO
43 implements Serializable, Comparable<RuleParameterVO>
44 {
45 /** The serial version UID of this class. Needed for serialization. */
46 private static final long serialVersionUID = -1572485920897249435L;
47
48 // Class attributes
49 /** TODO: Model Documentation for attribute ruleParId */
50 protected Integer ruleParId;
51 /** TODO: Model Documentation for attribute ruleParValue */
52 protected String ruleParValue;
53 /** TODO: Model Documentation for attribute updateDt */
54 protected Timestamp updateDt;
55 /** TODO: Model Documentation for attribute ruleCd */
56 protected String ruleCd;
57 /** TODO: Model Documentation for attribute functionParId */
58 protected Integer functionParId;
59
60 // Class associationEnds
61 /** TODO: Model Documentation for attribute ruleVO */
62 protected RuleVO ruleVO;
63
64 /** Default Constructor with no properties */
65 public RuleParameterVO()
66 {
67 // Documented empty block - avoid compiler warning - no super constructor
68 }
69
70 /**
71 * Constructor taking only required properties
72 * @param ruleParIdIn Integer
73 * @param ruleParValueIn String
74 * @param ruleCdIn String
75 * @param functionParIdIn Integer
76 * @param ruleVOIn RuleVO
77 */
78 public RuleParameterVO(final Integer ruleParIdIn, final String ruleParValueIn, final String ruleCdIn, final Integer functionParIdIn, final RuleVO ruleVOIn)
79 {
80 this.ruleParId = ruleParIdIn;
81 this.ruleParValue = ruleParValueIn;
82 this.ruleCd = ruleCdIn;
83 this.functionParId = functionParIdIn;
84 this.ruleVO = ruleVOIn;
85 }
86
87 /**
88 * Constructor with all properties
89 * @param ruleParIdIn Integer
90 * @param ruleParValueIn String
91 * @param updateDtIn Timestamp
92 * @param ruleCdIn String
93 * @param functionParIdIn Integer
94 * @param ruleVOIn RuleVO
95 */
96 public RuleParameterVO(final Integer ruleParIdIn, final String ruleParValueIn, final Timestamp updateDtIn, final String ruleCdIn, final Integer functionParIdIn, final RuleVO ruleVOIn)
97 {
98 this.ruleParId = ruleParIdIn;
99 this.ruleParValue = ruleParValueIn;
100 this.updateDt = updateDtIn;
101 this.ruleCd = ruleCdIn;
102 this.functionParId = functionParIdIn;
103 this.ruleVO = ruleVOIn;
104 }
105
106 /**
107 * Copies constructor from other RuleParameterVO
108 *
109 * @param otherBean Cannot be <code>null</code>
110 * @throws NullPointerException if the argument is <code>null</code>
111 */
112 public RuleParameterVO(final RuleParameterVO otherBean)
113 {
114 this.ruleParId = otherBean.getRuleParId();
115 this.ruleParValue = otherBean.getRuleParValue();
116 this.updateDt = otherBean.getUpdateDt();
117 this.ruleCd = otherBean.getRuleCd();
118 this.functionParId = otherBean.getFunctionParId();
119 this.ruleVO = otherBean.getRuleVO();
120 }
121
122 /**
123 * Copies all properties from the argument value object into this value object.
124 * @param otherBean Cannot be <code>null</code>
125 */
126 public void copy(final RuleParameterVO otherBean)
127 {
128 if (null != otherBean)
129 {
130 this.setRuleParId(otherBean.getRuleParId());
131 this.setRuleParValue(otherBean.getRuleParValue());
132 this.setUpdateDt(otherBean.getUpdateDt());
133 this.setRuleCd(otherBean.getRuleCd());
134 this.setFunctionParId(otherBean.getFunctionParId());
135 this.setRuleVO(otherBean.getRuleVO());
136 }
137 }
138
139 /**
140 * TODO: Model Documentation for attribute ruleParId
141 * Get the ruleParId Attribute
142 * @return ruleParId Integer
143 */
144 public Integer getRuleParId()
145 {
146 return this.ruleParId;
147 }
148
149 /**
150 *
151 * @param value Integer
152 */
153 public void setRuleParId(final Integer value)
154 {
155 this.ruleParId = value;
156 }
157
158 /**
159 * TODO: Model Documentation for attribute ruleParValue
160 * Get the ruleParValue Attribute
161 * @return ruleParValue String
162 */
163 public String getRuleParValue()
164 {
165 return this.ruleParValue;
166 }
167
168 /**
169 *
170 * @param value String
171 */
172 public void setRuleParValue(final String value)
173 {
174 this.ruleParValue = value;
175 }
176
177 /**
178 * TODO: Model Documentation for attribute updateDt
179 * Get the updateDt Attribute
180 * @return updateDt Timestamp
181 */
182 public Timestamp getUpdateDt()
183 {
184 return this.updateDt;
185 }
186
187 /**
188 *
189 * @param value Timestamp
190 */
191 public void setUpdateDt(final Timestamp value)
192 {
193 this.updateDt = value;
194 }
195
196 /**
197 * TODO: Model Documentation for attribute ruleCd
198 * Get the ruleCd Attribute
199 * @return ruleCd String
200 */
201 public String getRuleCd()
202 {
203 return this.ruleCd;
204 }
205
206 /**
207 *
208 * @param value String
209 */
210 public void setRuleCd(final String value)
211 {
212 this.ruleCd = value;
213 }
214
215 /**
216 * TODO: Model Documentation for attribute functionParId
217 * Get the functionParId Attribute
218 * @return functionParId Integer
219 */
220 public Integer getFunctionParId()
221 {
222 return this.functionParId;
223 }
224
225 /**
226 *
227 * @param value Integer
228 */
229 public void setFunctionParId(final Integer value)
230 {
231 this.functionParId = value;
232 }
233
234 /**
235 * TODO: Model Documentation for association ruleVO
236 * Get the ruleVO Association
237 * @return this.ruleVO RuleVO
238 */
239 public RuleVO getRuleVO()
240 {
241 return this.ruleVO;
242 }
243
244 /**
245 * Sets the ruleVO
246 * @param value RuleVO
247 */
248 public void setRuleVO(RuleVO value)
249 {
250 this.ruleVO = value;
251 }
252
253 /**
254 * @param object to compare this object against
255 * @return boolean if equal
256 * @see Object#equals(Object)
257 */
258 @Override
259 public boolean equals(final Object object)
260 {
261 if (object==null || object.getClass() != this.getClass())
262 {
263 return false;
264 }
265 // Check if the same object instance
266 if (object==this)
267 {
268 return true;
269 }
270 RuleParameterVO rhs = (RuleParameterVO) object;
271 return new EqualsBuilder()
272 .append(this.getRuleParId(), rhs.getRuleParId())
273 .append(this.getRuleParValue(), rhs.getRuleParValue())
274 .append(this.getUpdateDt(), rhs.getUpdateDt())
275 .append(this.getRuleCd(), rhs.getRuleCd())
276 .append(this.getFunctionParId(), rhs.getFunctionParId())
277 .append(this.getRuleVO(), rhs.getRuleVO())
278 .isEquals();
279 }
280
281 /**
282 * @param object to compare this object against
283 * @return int if equal
284 * @see Comparable#compareTo(Object)
285 */
286 public int compareTo(final RuleParameterVO object)
287 {
288 if (object==null)
289 {
290 return -1;
291 }
292 // Check if the same object instance
293 if (object==this)
294 {
295 return 0;
296 }
297 return new CompareToBuilder()
298 .append(this.getRuleParId(), object.getRuleParId())
299 .append(this.getRuleParValue(), object.getRuleParValue())
300 .append(this.getUpdateDt(), object.getUpdateDt())
301 .append(this.getRuleCd(), object.getRuleCd())
302 .append(this.getFunctionParId(), object.getFunctionParId())
303 .append(this.getRuleVO(), object.getRuleVO())
304 .toComparison();
305 }
306
307 /**
308 * @return int hashCode value
309 * @see Object#hashCode()
310 */
311 @Override
312 public int hashCode()
313 {
314 return new HashCodeBuilder(1249046965, -82296885)
315 .append(this.getRuleParId())
316 .append(this.getRuleParValue())
317 .append(this.getUpdateDt())
318 .append(this.getRuleCd())
319 .append(this.getFunctionParId())
320 .append(this.getRuleVO())
321 .toHashCode();
322 }
323
324 /**
325 * @return String representation of object
326 * @see Object#toString()
327 */
328 @Override
329 public String toString()
330 {
331 return new ToStringBuilder(this)
332 .append("ruleParId", this.getRuleParId())
333 .append("ruleParValue", this.getRuleParValue())
334 .append("updateDt", this.getUpdateDt())
335 .append("ruleCd", this.getRuleCd())
336 .append("functionParId", this.getFunctionParId())
337 .append("ruleVO", this.getRuleVO())
338 .toString();
339 }
340
341 /**
342 * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
343 * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
344 * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
345 *
346 * <p/>Note that for array, collection or map instances the comparison runs one level deep.
347 *
348 * @param first the first object to compare, may be {@code null}
349 * @param second the second object to compare, may be {@code null}
350 * @return this method will return {@code true} in case both objects are equal as explained above;
351 * in all other cases this method will return {@code false}
352 */
353 protected static boolean equal(final Object first, final Object second)
354 {
355 final boolean equal;
356
357 if (first == null)
358 {
359 equal = (second == null);
360 }
361 else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
362 {
363 equal = Arrays.equals((Object[])first, (Object[])second);
364 }
365 else // note that the following also covers java.util.Collection and java.util.Map
366 {
367 equal = first.equals(second);
368 }
369
370 return equal;
371 }
372
373 // RuleParameterVO value-object java merge-point
374 }