1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package fr.ifremer.quadrige3.core.vo.administration.user;
30
31 import java.io.Serializable;
32 import java.sql.Timestamp;
33 import java.util.Arrays;
34 import java.util.Date;
35 import org.apache.commons.lang3.builder.CompareToBuilder;
36 import org.apache.commons.lang3.builder.EqualsBuilder;
37 import org.apache.commons.lang3.builder.HashCodeBuilder;
38 import org.apache.commons.lang3.builder.ToStringBuilder;
39
40
41
42
43 public class DepartmentVO
44 implements Serializable, Comparable<DepartmentVO>
45 {
46
47 private static final long serialVersionUID = 4776030081060966098L;
48
49
50
51
52
53 protected Integer depId;
54
55
56
57
58 protected String depCd;
59
60
61
62
63 protected String depNm;
64
65
66
67 protected String depDc;
68
69
70
71 protected String depEMail;
72
73
74
75 protected String depAddress;
76
77
78
79 protected String depPhone;
80
81
82
83 protected String depLdapPresent;
84
85
86
87 protected Date depCreationDt;
88
89
90
91 protected Timestamp updateDt;
92
93
94
95 protected String statusCd;
96
97 protected Integer parentDepartmentId;
98
99
100
101 protected PrivilegeVO[] privileges;
102
103
104 public DepartmentVO()
105 {
106
107 }
108
109
110
111
112
113
114
115
116
117
118 public DepartmentVO(final Integer depIdIn, final String depCdIn, final String depNmIn, final String statusCdIn)
119 {
120 this.depId = depIdIn;
121 this.depCd = depCdIn;
122 this.depNm = depNmIn;
123 this.statusCd = statusCdIn;
124 }
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142 public DepartmentVO(final Integer depIdIn, final String depCdIn, final String depNmIn, final String depDcIn, final String depEMailIn, final String depAddressIn, final String depPhoneIn, final String depLdapPresentIn, final Date depCreationDtIn, final Timestamp updateDtIn, final String statusCdIn, final Integer parentDepartmentIdIn, final PrivilegeVO[] privilegesIn)
143 {
144 this.depId = depIdIn;
145 this.depCd = depCdIn;
146 this.depNm = depNmIn;
147 this.depDc = depDcIn;
148 this.depEMail = depEMailIn;
149 this.depAddress = depAddressIn;
150 this.depPhone = depPhoneIn;
151 this.depLdapPresent = depLdapPresentIn;
152 this.depCreationDt = depCreationDtIn;
153 this.updateDt = updateDtIn;
154 this.statusCd = statusCdIn;
155 this.parentDepartmentId = parentDepartmentIdIn;
156 this.privileges = privilegesIn;
157 }
158
159
160
161
162
163
164
165 public DepartmentVO(final DepartmentVO otherBean)
166 {
167 this.depId = otherBean.getDepId();
168 this.depCd = otherBean.getDepCd();
169 this.depNm = otherBean.getDepNm();
170 this.depDc = otherBean.getDepDc();
171 this.depEMail = otherBean.getDepEMail();
172 this.depAddress = otherBean.getDepAddress();
173 this.depPhone = otherBean.getDepPhone();
174 this.depLdapPresent = otherBean.getDepLdapPresent();
175 this.depCreationDt = otherBean.getDepCreationDt();
176 this.updateDt = otherBean.getUpdateDt();
177 this.statusCd = otherBean.getStatusCd();
178 this.parentDepartmentId = otherBean.getParentDepartmentId();
179 this.privileges = otherBean.getPrivileges();
180 }
181
182
183
184
185
186 public void copy(final DepartmentVO otherBean)
187 {
188 if (null != otherBean)
189 {
190 this.setDepId(otherBean.getDepId());
191 this.setDepCd(otherBean.getDepCd());
192 this.setDepNm(otherBean.getDepNm());
193 this.setDepDc(otherBean.getDepDc());
194 this.setDepEMail(otherBean.getDepEMail());
195 this.setDepAddress(otherBean.getDepAddress());
196 this.setDepPhone(otherBean.getDepPhone());
197 this.setDepLdapPresent(otherBean.getDepLdapPresent());
198 this.setDepCreationDt(otherBean.getDepCreationDt());
199 this.setUpdateDt(otherBean.getUpdateDt());
200 this.setStatusCd(otherBean.getStatusCd());
201 this.setParentDepartmentId(otherBean.getParentDepartmentId());
202 this.setPrivileges(otherBean.getPrivileges());
203 }
204 }
205
206
207
208
209
210
211 public Integer getDepId()
212 {
213 return this.depId;
214 }
215
216
217
218
219
220 public void setDepId(final Integer value)
221 {
222 this.depId = value;
223 }
224
225
226
227
228
229
230
231 public String getDepCd()
232 {
233 return this.depCd;
234 }
235
236
237
238
239
240
241 public void setDepCd(final String value)
242 {
243 this.depCd = value;
244 }
245
246
247
248
249
250
251
252 public String getDepNm()
253 {
254 return this.depNm;
255 }
256
257
258
259
260
261
262 public void setDepNm(final String value)
263 {
264 this.depNm = value;
265 }
266
267
268
269
270
271
272 public String getDepDc()
273 {
274 return this.depDc;
275 }
276
277
278
279
280
281 public void setDepDc(final String value)
282 {
283 this.depDc = value;
284 }
285
286
287
288
289
290
291 public String getDepEMail()
292 {
293 return this.depEMail;
294 }
295
296
297
298
299
300 public void setDepEMail(final String value)
301 {
302 this.depEMail = value;
303 }
304
305
306
307
308
309
310 public String getDepAddress()
311 {
312 return this.depAddress;
313 }
314
315
316
317
318
319 public void setDepAddress(final String value)
320 {
321 this.depAddress = value;
322 }
323
324
325
326
327
328
329 public String getDepPhone()
330 {
331 return this.depPhone;
332 }
333
334
335
336
337
338 public void setDepPhone(final String value)
339 {
340 this.depPhone = value;
341 }
342
343
344
345
346
347
348 public String getDepLdapPresent()
349 {
350 return this.depLdapPresent;
351 }
352
353
354
355
356
357 public void setDepLdapPresent(final String value)
358 {
359 this.depLdapPresent = value;
360 }
361
362
363
364
365
366
367 public Date getDepCreationDt()
368 {
369 return this.depCreationDt;
370 }
371
372
373
374
375
376 public void setDepCreationDt(final Date value)
377 {
378 this.depCreationDt = value;
379 }
380
381
382
383
384
385
386 public Timestamp getUpdateDt()
387 {
388 return this.updateDt;
389 }
390
391
392
393
394
395 public void setUpdateDt(final Timestamp value)
396 {
397 this.updateDt = value;
398 }
399
400
401
402
403
404
405 public String getStatusCd()
406 {
407 return this.statusCd;
408 }
409
410
411
412
413
414 public void setStatusCd(final String value)
415 {
416 this.statusCd = value;
417 }
418
419
420
421
422
423
424 public Integer getParentDepartmentId()
425 {
426 return this.parentDepartmentId;
427 }
428
429
430
431
432
433 public void setParentDepartmentId(final Integer value)
434 {
435 this.parentDepartmentId = value;
436 }
437
438
439
440
441
442
443
444
445
446 public PrivilegeVO[] getPrivileges()
447 {
448 return this.privileges;
449 }
450
451
452
453
454
455 public void setPrivileges(PrivilegeVO[] value)
456 {
457 this.privileges = value;
458 }
459
460
461
462
463
464
465 @Override
466 public boolean equals(final Object object)
467 {
468 if (object==null || object.getClass() != this.getClass())
469 {
470 return false;
471 }
472
473 if (object==this)
474 {
475 return true;
476 }
477 DepartmentVO rhs = (DepartmentVO) object;
478 return new EqualsBuilder()
479 .append(this.getDepId(), rhs.getDepId())
480 .append(this.getDepCd(), rhs.getDepCd())
481 .append(this.getDepNm(), rhs.getDepNm())
482 .append(this.getDepDc(), rhs.getDepDc())
483 .append(this.getDepEMail(), rhs.getDepEMail())
484 .append(this.getDepAddress(), rhs.getDepAddress())
485 .append(this.getDepPhone(), rhs.getDepPhone())
486 .append(this.getDepLdapPresent(), rhs.getDepLdapPresent())
487 .append(this.getDepCreationDt(), rhs.getDepCreationDt())
488 .append(this.getUpdateDt(), rhs.getUpdateDt())
489 .append(this.getStatusCd(), rhs.getStatusCd())
490 .append(this.getParentDepartmentId(), rhs.getParentDepartmentId())
491 .append(this.getPrivileges(), rhs.getPrivileges())
492 .isEquals();
493 }
494
495
496
497
498
499
500 public int compareTo(final DepartmentVO object)
501 {
502 if (object==null)
503 {
504 return -1;
505 }
506
507 if (object==this)
508 {
509 return 0;
510 }
511 return new CompareToBuilder()
512 .append(this.getDepId(), object.getDepId())
513 .append(this.getDepCd(), object.getDepCd())
514 .append(this.getDepNm(), object.getDepNm())
515 .append(this.getDepDc(), object.getDepDc())
516 .append(this.getDepEMail(), object.getDepEMail())
517 .append(this.getDepAddress(), object.getDepAddress())
518 .append(this.getDepPhone(), object.getDepPhone())
519 .append(this.getDepLdapPresent(), object.getDepLdapPresent())
520 .append(this.getDepCreationDt(), object.getDepCreationDt())
521 .append(this.getUpdateDt(), object.getUpdateDt())
522 .append(this.getStatusCd(), object.getStatusCd())
523 .append(this.getParentDepartmentId(), object.getParentDepartmentId())
524 .append(this.getPrivileges(), object.getPrivileges())
525 .toComparison();
526 }
527
528
529
530
531
532 @Override
533 public int hashCode()
534 {
535 return new HashCodeBuilder(1249046965, -82296885)
536 .append(this.getDepId())
537 .append(this.getDepCd())
538 .append(this.getDepNm())
539 .append(this.getDepDc())
540 .append(this.getDepEMail())
541 .append(this.getDepAddress())
542 .append(this.getDepPhone())
543 .append(this.getDepLdapPresent())
544 .append(this.getDepCreationDt())
545 .append(this.getUpdateDt())
546 .append(this.getStatusCd())
547 .append(this.getParentDepartmentId())
548
549
550 .toHashCode();
551 }
552
553
554
555
556
557 @Override
558 public String toString()
559 {
560 return new ToStringBuilder(this)
561 .append("depId", this.getDepId())
562 .append("depCd", this.getDepCd())
563 .append("depNm", this.getDepNm())
564 .append("depDc", this.getDepDc())
565 .append("depEMail", this.getDepEMail())
566 .append("depAddress", this.getDepAddress())
567 .append("depPhone", this.getDepPhone())
568 .append("depLdapPresent", this.getDepLdapPresent())
569 .append("depCreationDt", this.getDepCreationDt())
570 .append("updateDt", this.getUpdateDt())
571 .append("statusCd", this.getStatusCd())
572 .append("parentDepartmentId", this.getParentDepartmentId())
573 .append("privileges", this.getPrivileges())
574 .toString();
575 }
576
577
578
579
580
581
582
583
584
585
586
587
588
589 protected static boolean equal(final Object first, final Object second)
590 {
591 final boolean equal;
592
593 if (first == null)
594 {
595 equal = (second == null);
596 }
597 else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
598 {
599 equal = Arrays.equals((Object[])first, (Object[])second);
600 }
601 else
602 {
603 equal = first.equals(second);
604 }
605
606 return equal;
607 }
608
609
610 }