1
2
3
4
5
6 package fr.ifremer.quadrige2.core.dao.system.context;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 import fr.ifremer.quadrige2.core.dao.administration.user.Department;
30 import fr.ifremer.quadrige2.core.dao.administration.user.Quser;
31 import fr.ifremer.quadrige2.core.dao.referential.Status;
32 import fr.ifremer.quadrige2.core.dao.referential.order.OrderItemType;
33 import fr.ifremer.quadrige2.core.dao.system.MapProject;
34 import fr.ifremer.quadrige2.core.dao.system.filter.Filter;
35 import java.io.Serializable;
36 import java.sql.Timestamp;
37 import java.util.Collection;
38 import java.util.Date;
39 import java.util.HashSet;
40
41
42
43
44
45 public abstract class Context
46 implements Serializable, Comparable<Context>
47 {
48
49
50
51 private static final long serialVersionUID = -340505072133734679L;
52
53
54 private Integer contextId;
55
56
57
58
59
60 public Integer getContextId()
61 {
62 return this.contextId;
63 }
64
65
66
67
68
69 public void setContextId(Integer contextIdIn)
70 {
71 this.contextId = contextIdIn;
72 }
73
74 private String contextNm;
75
76
77
78
79
80 public String getContextNm()
81 {
82 return this.contextNm;
83 }
84
85
86
87
88
89 public void setContextNm(String contextNmIn)
90 {
91 this.contextNm = contextNmIn;
92 }
93
94 private String contextDc;
95
96
97
98
99
100 public String getContextDc()
101 {
102 return this.contextDc;
103 }
104
105
106
107
108
109 public void setContextDc(String contextDcIn)
110 {
111 this.contextDc = contextDcIn;
112 }
113
114 private String contextIsDefault;
115
116
117
118
119
120 public String getContextIsDefault()
121 {
122 return this.contextIsDefault;
123 }
124
125
126
127
128
129 public void setContextIsDefault(String contextIsDefaultIn)
130 {
131 this.contextIsDefault = contextIsDefaultIn;
132 }
133
134 private Double contextSurveyOrder;
135
136
137
138
139
140 public Double getContextSurveyOrder()
141 {
142 return this.contextSurveyOrder;
143 }
144
145
146
147
148
149 public void setContextSurveyOrder(Double contextSurveyOrderIn)
150 {
151 this.contextSurveyOrder = contextSurveyOrderIn;
152 }
153
154 private Double contextTaxonDisplay;
155
156
157
158
159
160 public Double getContextTaxonDisplay()
161 {
162 return this.contextTaxonDisplay;
163 }
164
165
166
167
168
169 public void setContextTaxonDisplay(Double contextTaxonDisplayIn)
170 {
171 this.contextTaxonDisplay = contextTaxonDisplayIn;
172 }
173
174 private Double contextInitPopOrder;
175
176
177
178
179
180 public Double getContextInitPopOrder()
181 {
182 return this.contextInitPopOrder;
183 }
184
185
186
187
188
189 public void setContextInitPopOrder(Double contextInitPopOrderIn)
190 {
191 this.contextInitPopOrder = contextInitPopOrderIn;
192 }
193
194 private Float contextPlugZone;
195
196
197
198
199
200 public Float getContextPlugZone()
201 {
202 return this.contextPlugZone;
203 }
204
205
206
207
208
209 public void setContextPlugZone(Float contextPlugZoneIn)
210 {
211 this.contextPlugZone = contextPlugZoneIn;
212 }
213
214 private Date contextCreationDt;
215
216
217
218
219
220 public Date getContextCreationDt()
221 {
222 return this.contextCreationDt;
223 }
224
225
226
227
228
229 public void setContextCreationDt(Date contextCreationDtIn)
230 {
231 this.contextCreationDt = contextCreationDtIn;
232 }
233
234 private Timestamp updateDt;
235
236
237
238
239
240 public Timestamp getUpdateDt()
241 {
242 return this.updateDt;
243 }
244
245
246
247
248
249 public void setUpdateDt(Timestamp updateDtIn)
250 {
251 this.updateDt = updateDtIn;
252 }
253
254
255 private Status status;
256
257
258
259
260
261 public Status getStatus()
262 {
263 return this.status;
264 }
265
266
267
268
269
270 public void setStatus(Status statusIn)
271 {
272 this.status = statusIn;
273 }
274
275 private Collection<Filter> filters = new HashSet<Filter>();
276
277
278
279
280
281
282
283 public Collection<Filter> getFilters()
284 {
285 return this.filters;
286 }
287
288
289
290
291
292
293
294 public void setFilters(Collection<Filter> filtersIn)
295 {
296 this.filters = filtersIn;
297 }
298
299
300
301
302
303
304
305
306
307 public boolean addFilters(Filter elementToAdd)
308 {
309 return this.filters.add(elementToAdd);
310 }
311
312
313
314
315
316
317
318
319
320 public boolean removeFilters(Filter elementToRemove)
321 {
322 return this.filters.remove(elementToRemove);
323 }
324
325 private Collection<DefaultValue> defaultValues = new HashSet<DefaultValue>();
326
327
328
329
330
331 public Collection<DefaultValue> getDefaultValues()
332 {
333 return this.defaultValues;
334 }
335
336
337
338
339
340 public void setDefaultValues(Collection<DefaultValue> defaultValuesIn)
341 {
342 this.defaultValues = defaultValuesIn;
343 }
344
345
346
347
348
349
350
351 public boolean addDefaultValues(DefaultValue elementToAdd)
352 {
353 return this.defaultValues.add(elementToAdd);
354 }
355
356
357
358
359
360
361
362 public boolean removeDefaultValues(DefaultValue elementToRemove)
363 {
364 return this.defaultValues.remove(elementToRemove);
365 }
366
367 private MapProject mapProject;
368
369
370
371
372
373 public MapProject getMapProject()
374 {
375 return this.mapProject;
376 }
377
378
379
380
381
382 public void setMapProject(MapProject mapProjectIn)
383 {
384 this.mapProject = mapProjectIn;
385 }
386
387 private Collection<Department> departments = new HashSet<Department>();
388
389
390
391
392
393 public Collection<Department> getDepartments()
394 {
395 return this.departments;
396 }
397
398
399
400
401
402 public void setDepartments(Collection<Department> departmentsIn)
403 {
404 this.departments = departmentsIn;
405 }
406
407
408
409
410
411
412
413 public boolean addDepartments(Department elementToAdd)
414 {
415 return this.departments.add(elementToAdd);
416 }
417
418
419
420
421
422
423
424 public boolean removeDepartments(Department elementToRemove)
425 {
426 return this.departments.remove(elementToRemove);
427 }
428
429 private Quser quser;
430
431
432
433
434
435 public Quser getQuser()
436 {
437 return this.quser;
438 }
439
440
441
442
443
444 public void setQuser(Quser quserIn)
445 {
446 this.quser = quserIn;
447 }
448
449 private OrderItemType orderItemType;
450
451
452
453
454
455
456
457 public OrderItemType getOrderItemType()
458 {
459 return this.orderItemType;
460 }
461
462
463
464
465
466
467
468 public void setOrderItemType(OrderItemType orderItemTypeIn)
469 {
470 this.orderItemType = orderItemTypeIn;
471 }
472
473
474
475
476
477 @Override
478 public boolean equals(Object object)
479 {
480 if (this == object)
481 {
482 return true;
483 }
484 if (!(object instanceof Context))
485 {
486 return false;
487 }
488 final Context that = (Context)object;
489 if (this.contextId == null || that.getContextId() == null || !this.contextId.equals(that.getContextId()))
490 {
491 return false;
492 }
493 return true;
494 }
495
496
497
498
499 @Override
500 public int hashCode()
501 {
502 int hashCode = 0;
503 hashCode = 29 * hashCode + (this.contextId == null ? 0 : this.contextId.hashCode());
504
505 return hashCode;
506 }
507
508
509
510
511 public static final class Factory
512 {
513
514
515
516
517 public static Context newInstance()
518 {
519 return new ContextImpl();
520 }
521
522
523
524
525
526
527
528
529
530 public static Context newInstance(String contextNm, Timestamp updateDt, Status status)
531 {
532 final Context entity = new ContextImpl();
533 entity.setContextNm(contextNm);
534 entity.setUpdateDt(updateDt);
535 entity.setStatus(status);
536 return entity;
537 }
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560 public static Context newInstance(String contextNm, String contextDc, String contextIsDefault, Double contextSurveyOrder, Double contextTaxonDisplay, Double contextInitPopOrder, Float contextPlugZone, Date contextCreationDt, Timestamp updateDt, Status status, Collection<Filter> filters, Collection<DefaultValue> defaultValues, MapProject mapProject, Collection<Department> departments, Quser quser, OrderItemType orderItemType)
561 {
562 final Context entity = new ContextImpl();
563 entity.setContextNm(contextNm);
564 entity.setContextDc(contextDc);
565 entity.setContextIsDefault(contextIsDefault);
566 entity.setContextSurveyOrder(contextSurveyOrder);
567 entity.setContextTaxonDisplay(contextTaxonDisplay);
568 entity.setContextInitPopOrder(contextInitPopOrder);
569 entity.setContextPlugZone(contextPlugZone);
570 entity.setContextCreationDt(contextCreationDt);
571 entity.setUpdateDt(updateDt);
572 entity.setStatus(status);
573 entity.setFilters(filters);
574 entity.setDefaultValues(defaultValues);
575 entity.setMapProject(mapProject);
576 entity.setDepartments(departments);
577 entity.setQuser(quser);
578 entity.setOrderItemType(orderItemType);
579 return entity;
580 }
581 }
582
583
584
585
586 public int compareTo(Context o)
587 {
588 int cmp = 0;
589 if (this.getContextId() != null)
590 {
591 cmp = this.getContextId().compareTo(o.getContextId());
592 }
593 else
594 {
595 if (this.getContextNm() != null)
596 {
597 cmp = (cmp != 0 ? cmp : this.getContextNm().compareTo(o.getContextNm()));
598 }
599 if (this.getContextDc() != null)
600 {
601 cmp = (cmp != 0 ? cmp : this.getContextDc().compareTo(o.getContextDc()));
602 }
603 if (this.getContextIsDefault() != null)
604 {
605 cmp = (cmp != 0 ? cmp : this.getContextIsDefault().compareTo(o.getContextIsDefault()));
606 }
607 if (this.getContextSurveyOrder() != null)
608 {
609 cmp = (cmp != 0 ? cmp : this.getContextSurveyOrder().compareTo(o.getContextSurveyOrder()));
610 }
611 if (this.getContextTaxonDisplay() != null)
612 {
613 cmp = (cmp != 0 ? cmp : this.getContextTaxonDisplay().compareTo(o.getContextTaxonDisplay()));
614 }
615 if (this.getContextInitPopOrder() != null)
616 {
617 cmp = (cmp != 0 ? cmp : this.getContextInitPopOrder().compareTo(o.getContextInitPopOrder()));
618 }
619 if (this.getContextPlugZone() != null)
620 {
621 cmp = (cmp != 0 ? cmp : this.getContextPlugZone().compareTo(o.getContextPlugZone()));
622 }
623 if (this.getContextCreationDt() != null)
624 {
625 cmp = (cmp != 0 ? cmp : this.getContextCreationDt().compareTo(o.getContextCreationDt()));
626 }
627 if (this.getUpdateDt() != null)
628 {
629 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
630 }
631 }
632 return cmp;
633 }
634
635
636 }