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