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