1 package fr.ifremer.reefdb.ui.swing.content.manage.program.programs;
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 import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
27 import fr.ifremer.reefdb.dto.ErrorDTO;
28 import fr.ifremer.reefdb.dto.ReefDbBeanFactory;
29 import fr.ifremer.reefdb.dto.ReefDbBeans;
30 import fr.ifremer.reefdb.dto.configuration.programStrategy.ProgramDTO;
31 import fr.ifremer.reefdb.dto.configuration.programStrategy.StrategyDTO;
32 import fr.ifremer.reefdb.dto.referential.DepartmentDTO;
33 import fr.ifremer.reefdb.dto.referential.LocationDTO;
34 import fr.ifremer.reefdb.dto.referential.PersonDTO;
35 import fr.ifremer.reefdb.ui.swing.util.table.AbstractReefDbRowUIModel;
36 import org.nuiton.util.beans.Binder;
37 import org.nuiton.util.beans.BinderFactory;
38
39 import java.util.Collection;
40 import java.util.Date;
41 import java.util.List;
42
43
44
45
46 public class ProgramsTableRowModel extends AbstractReefDbRowUIModel<ProgramDTO, ProgramsTableRowModel> implements ProgramDTO {
47
48 private static final Binder<ProgramDTO, ProgramsTableRowModel> FROM_BEAN_BINDER =
49 BinderFactory.newBinder(ProgramDTO.class, ProgramsTableRowModel.class);
50 private static final Binder<ProgramsTableRowModel, ProgramDTO> TO_BEAN_BINDER =
51 BinderFactory.newBinder(ProgramsTableRowModel.class, ProgramDTO.class);
52 private boolean currentUserIsManager;
53 private boolean strategiesValid = true;
54 private boolean locationsValid = true;
55
56
57
58
59 public ProgramsTableRowModel() {
60 super(FROM_BEAN_BINDER, TO_BEAN_BINDER);
61 }
62
63
64
65
66
67
68 public boolean isCurrentUserIsManager() {
69 return currentUserIsManager;
70 }
71
72
73
74
75
76
77 public void setCurrentUserIsManager(boolean currentUserIsManager) {
78 this.currentUserIsManager = currentUserIsManager;
79 }
80
81
82
83
84
85
86 public boolean isStrategiesValid() {
87 return strategiesValid;
88 }
89
90
91
92
93
94
95 public void setStrategiesValid(boolean strategiesValid) {
96 this.strategiesValid = strategiesValid;
97 }
98
99
100
101
102
103
104 public boolean isLocationsValid() {
105 return locationsValid;
106 }
107
108
109
110
111
112
113 public void setLocationsValid(boolean locationsValid) {
114 this.locationsValid = locationsValid;
115 }
116
117
118 @Override
119 public boolean isEditable() {
120 return super.isEditable() && !isReadOnly() && isCurrentUserIsManager();
121 }
122
123
124
125
126
127
128 public boolean isLocal() {
129 return ReefDbBeans.isLocalStatus(getStatus());
130 }
131
132
133 @Override
134 protected ProgramDTO newBean() {
135 return ReefDbBeanFactory.newProgramDTO();
136 }
137
138
139 @Override
140 public StatusDTO getStatus() {
141 return delegateObject.getStatus();
142 }
143
144
145 @Override
146 public void setStatus(StatusDTO status) {
147 delegateObject.setStatus(status);
148 }
149
150
151 @Override
152 public String getCode() {
153 return delegateObject.getCode();
154 }
155
156
157 @Override
158 public void setCode(String code) {
159 delegateObject.setCode(code);
160 }
161
162 @Override
163 public String getDescription() {
164 return delegateObject.getDescription();
165 }
166
167 @Override
168 public void setDescription(String description) {
169 delegateObject.setDescription(description);
170 }
171
172
173 @Override
174 public String getName() {
175 return delegateObject.getName();
176 }
177
178
179 @Override
180 public void setName(String name) {
181 delegateObject.setName(name);
182 }
183
184
185 @Override
186 public String getComment() {
187 return delegateObject.getComment();
188 }
189
190
191 @Override
192 public void setComment(String comment) {
193 delegateObject.setComment(comment);
194 }
195
196
197 @Override
198 public StrategyDTO getStrategies(int index) {
199 return delegateObject.getStrategies(index);
200 }
201
202
203 @Override
204 public boolean isStrategiesEmpty() {
205 return delegateObject.isStrategiesEmpty();
206 }
207
208
209 @Override
210 public int sizeStrategies() {
211 return delegateObject.sizeStrategies();
212 }
213
214
215 @Override
216 public void addStrategies(StrategyDTO strategy) {
217 delegateObject.addStrategies(strategy);
218 }
219
220
221 @Override
222 public void addAllStrategies(Collection<StrategyDTO> strategy) {
223 delegateObject.addAllStrategies(strategy);
224 }
225
226
227 @Override
228 public boolean removeStrategies(StrategyDTO strategy) {
229 return delegateObject.removeStrategies(strategy);
230 }
231
232
233 @Override
234 public boolean removeAllStrategies(Collection<StrategyDTO> strategy) {
235 return delegateObject.removeAllStrategies(strategy);
236 }
237
238
239 @Override
240 public boolean containsStrategies(StrategyDTO strategy) {
241 return delegateObject.containsStrategies(strategy);
242 }
243
244
245 @Override
246 public boolean containsAllStrategies(Collection<StrategyDTO> strategy) {
247 return delegateObject.containsAllStrategies(strategy);
248 }
249
250
251 @Override
252 public Collection<StrategyDTO> getStrategies() {
253 return delegateObject.getStrategies();
254 }
255
256
257 @Override
258 public void setStrategies(Collection<StrategyDTO> strategy) {
259 delegateObject.setStrategies(strategy);
260 }
261
262
263 @Override
264 public LocationDTO getLocations(int index) {
265 return delegateObject.getLocations(index);
266 }
267
268
269 @Override
270 public boolean isLocationsEmpty() {
271 return delegateObject.isLocationsEmpty();
272 }
273
274
275 @Override
276 public int sizeLocations() {
277 return delegateObject.sizeLocations();
278 }
279
280
281 @Override
282 public void addLocations(LocationDTO location) {
283 delegateObject.addLocations(location);
284 }
285
286
287 @Override
288 public void addAllLocations(Collection<LocationDTO> location) {
289 delegateObject.addAllLocations(location);
290 }
291
292
293 @Override
294 public boolean removeLocations(LocationDTO location) {
295 return delegateObject.removeLocations(location);
296 }
297
298
299 @Override
300 public boolean removeAllLocations(Collection<LocationDTO> location) {
301 return delegateObject.removeAllLocations(location);
302 }
303
304
305 @Override
306 public boolean containsLocations(LocationDTO location) {
307 return delegateObject.containsLocations(location);
308 }
309
310
311 @Override
312 public boolean containsAllLocations(Collection<LocationDTO> location) {
313 return delegateObject.containsAllLocations(location);
314 }
315
316
317 @Override
318 public List<LocationDTO> getLocations() {
319 return delegateObject.getLocations();
320 }
321
322
323 @Override
324 public void setLocations(List<LocationDTO> location) {
325 delegateObject.setLocations(location);
326 }
327
328
329 @Override
330 public ErrorDTO getErrors(int index) {
331 return delegateObject.getErrors(index);
332 }
333
334
335 @Override
336 public boolean isErrorsEmpty() {
337 return delegateObject.isErrorsEmpty();
338 }
339
340
341 @Override
342 public int sizeErrors() {
343 return delegateObject.sizeErrors();
344 }
345
346
347 @Override
348 public void addErrors(ErrorDTO errors) {
349 delegateObject.addErrors(errors);
350 }
351
352
353 @Override
354 public void addAllErrors(Collection<ErrorDTO> errors) {
355 delegateObject.addAllErrors(errors);
356 }
357
358
359 @Override
360 public boolean removeErrors(ErrorDTO errors) {
361 return delegateObject.removeErrors(errors);
362 }
363
364
365 @Override
366 public boolean removeAllErrors(Collection<ErrorDTO> errors) {
367 return delegateObject.removeAllErrors(errors);
368 }
369
370
371 @Override
372 public boolean containsErrors(ErrorDTO errors) {
373 return delegateObject.containsErrors(errors);
374 }
375
376
377 @Override
378 public boolean containsAllErrors(Collection<ErrorDTO> errors) {
379 return delegateObject.containsAllErrors(errors);
380 }
381
382
383 @Override
384 public Collection<ErrorDTO> getErrors() {
385 return delegateObject.getErrors();
386 }
387
388
389 @Override
390 public void setErrors(Collection<ErrorDTO> errors) {
391 delegateObject.setErrors(errors);
392 }
393
394
395 @Override
396 public PersonDTO getManagerPersons(int index) {
397 return delegateObject.getManagerPersons(index);
398 }
399
400
401 @Override
402 public boolean isManagerPersonsEmpty() {
403 return delegateObject.isManagerPersonsEmpty();
404 }
405
406
407 @Override
408 public int sizeManagerPersons() {
409 return delegateObject.sizeManagerPersons();
410 }
411
412
413 @Override
414 public void addManagerPersons(PersonDTO managerPersons) {
415 delegateObject.addManagerPersons(managerPersons);
416 }
417
418
419 @Override
420 public void addAllManagerPersons(Collection<PersonDTO> managerPersons) {
421 delegateObject.addAllManagerPersons(managerPersons);
422 }
423
424
425 @Override
426 public boolean removeManagerPersons(PersonDTO managerPersons) {
427 return delegateObject.removeManagerPersons(managerPersons);
428 }
429
430
431 @Override
432 public boolean removeAllManagerPersons(Collection<PersonDTO> managerPersons) {
433 return delegateObject.removeAllManagerPersons(managerPersons);
434 }
435
436
437 @Override
438 public boolean containsManagerPersons(PersonDTO managerPersons) {
439 return delegateObject.containsManagerPersons(managerPersons);
440 }
441
442
443 @Override
444 public boolean containsAllManagerPersons(Collection<PersonDTO> managerPersons) {
445 return delegateObject.containsAllManagerPersons(managerPersons);
446 }
447
448
449 @Override
450 public Collection<PersonDTO> getManagerPersons() {
451 return delegateObject.getManagerPersons();
452 }
453
454
455 @Override
456 public void setManagerPersons(Collection<PersonDTO> managerPersons) {
457 delegateObject.setManagerPersons(managerPersons);
458 }
459
460
461 @Override
462 public PersonDTO getRecorderPersons(int index) {
463 return delegateObject.getRecorderPersons(index);
464 }
465
466
467 @Override
468 public boolean isRecorderPersonsEmpty() {
469 return delegateObject.isRecorderPersonsEmpty();
470 }
471
472
473 @Override
474 public int sizeRecorderPersons() {
475 return delegateObject.sizeRecorderPersons();
476 }
477
478
479 @Override
480 public void addRecorderPersons(PersonDTO recorderPersons) {
481 delegateObject.addRecorderPersons(recorderPersons);
482 }
483
484
485 @Override
486 public void addAllRecorderPersons(Collection<PersonDTO> recorderPersons) {
487 delegateObject.addAllRecorderPersons(recorderPersons);
488 }
489
490
491 @Override
492 public boolean removeRecorderPersons(PersonDTO recorderPersons) {
493 return delegateObject.removeRecorderPersons(recorderPersons);
494 }
495
496
497 @Override
498 public boolean removeAllRecorderPersons(Collection<PersonDTO> recorderPersons) {
499 return delegateObject.removeAllRecorderPersons(recorderPersons);
500 }
501
502
503 @Override
504 public boolean containsRecorderPersons(PersonDTO recorderPersons) {
505 return delegateObject.containsRecorderPersons(recorderPersons);
506 }
507
508
509 @Override
510 public boolean containsAllRecorderPersons(Collection<PersonDTO> recorderPersons) {
511 return delegateObject.containsAllRecorderPersons(recorderPersons);
512 }
513
514
515 @Override
516 public Collection<PersonDTO> getRecorderPersons() {
517 return delegateObject.getRecorderPersons();
518 }
519
520
521 @Override
522 public void setRecorderPersons(Collection<PersonDTO> recorderPersons) {
523 delegateObject.setRecorderPersons(recorderPersons);
524 }
525
526
527 @Override
528 public DepartmentDTO getRecorderDepartments(int index) {
529 return delegateObject.getRecorderDepartments(index);
530 }
531
532
533 @Override
534 public boolean isRecorderDepartmentsEmpty() {
535 return delegateObject.isRecorderDepartmentsEmpty();
536 }
537
538
539 @Override
540 public int sizeRecorderDepartments() {
541 return delegateObject.sizeRecorderDepartments();
542 }
543
544
545 @Override
546 public void addRecorderDepartments(DepartmentDTO recorderDepartments) {
547 delegateObject.addRecorderDepartments(recorderDepartments);
548 }
549
550
551 @Override
552 public void addAllRecorderDepartments(Collection<DepartmentDTO> recorderDepartments) {
553 delegateObject.addAllRecorderDepartments(recorderDepartments);
554 }
555
556
557 @Override
558 public boolean removeRecorderDepartments(DepartmentDTO recorderDepartments) {
559 return delegateObject.removeRecorderDepartments(recorderDepartments);
560 }
561
562
563 @Override
564 public boolean removeAllRecorderDepartments(Collection<DepartmentDTO> recorderDepartments) {
565 return delegateObject.removeAllRecorderDepartments(recorderDepartments);
566 }
567
568
569 @Override
570 public boolean containsRecorderDepartments(DepartmentDTO recorderDepartments) {
571 return delegateObject.containsRecorderDepartments(recorderDepartments);
572 }
573
574
575 @Override
576 public boolean containsAllRecorderDepartments(Collection<DepartmentDTO> recorderDepartments) {
577 return delegateObject.containsAllRecorderDepartments(recorderDepartments);
578 }
579
580
581 @Override
582 public Collection<DepartmentDTO> getRecorderDepartments() {
583 return delegateObject.getRecorderDepartments();
584 }
585
586
587 @Override
588 public void setRecorderDepartments(Collection<DepartmentDTO> recorderDepartments) {
589 delegateObject.setRecorderDepartments(recorderDepartments);
590 }
591
592
593 @Override
594 public boolean isStrategiesLoaded() {
595 return delegateObject.isStrategiesLoaded();
596 }
597
598
599 @Override
600 public void setStrategiesLoaded(boolean strategiesLoaded) {
601 delegateObject.setStrategiesLoaded(strategiesLoaded);
602 }
603
604
605 @Override
606 public boolean isLocationsLoaded() {
607 return delegateObject.isLocationsLoaded();
608 }
609
610
611 @Override
612 public void setLocationsLoaded(boolean locationsLoaded) {
613 delegateObject.setLocationsLoaded(locationsLoaded);
614 }
615
616
617 @Override
618 public boolean isDirty() {
619 return delegateObject.isDirty();
620 }
621
622
623 @Override
624 public void setDirty(boolean dirty) {
625 delegateObject.setDirty(dirty);
626 }
627
628 @Override
629 public boolean isReadOnly() {
630 return delegateObject.isReadOnly();
631 }
632
633 @Override
634 public void setReadOnly(boolean readOnly) {
635 delegateObject.setReadOnly(readOnly);
636 }
637
638
639 @Override
640 public boolean isNewCode() {
641 return delegateObject.isNewCode();
642 }
643
644
645 @Override
646 public void setNewCode(boolean newCode) {
647 delegateObject.setNewCode(newCode);
648 }
649
650 @Override
651 public boolean isDepartmentHermetic() {
652 return delegateObject.isDepartmentHermetic();
653 }
654
655 @Override
656 public void setDepartmentHermetic(boolean departmentHermetic) {
657 delegateObject.setDepartmentHermetic(departmentHermetic);
658 }
659
660 @Override
661 public Date getCreationDate() {
662 return delegateObject.getCreationDate();
663 }
664
665 @Override
666 public void setCreationDate(Date date) {
667 delegateObject.setCreationDate(date);
668 }
669
670 @Override
671 public Date getUpdateDate() {
672 return delegateObject.getUpdateDate();
673 }
674
675 @Override
676 public void setUpdateDate(Date date) {
677 delegateObject.setUpdateDate(date);
678 }
679
680
681 }