1 package fr.ifremer.dali.dto.enums;
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.core.dao.system.filter.FilterTypeId;
27
28 import static org.nuiton.i18n.I18n.n;
29 import static org.nuiton.i18n.I18n.t;
30
31
32
33
34 public enum FilterTypeValues {
35
36 ANALYSIS_INSTRUMENT(FilterTypeId.ANALYSIS_INSTRUMENT, n("dali.core.enums.contextFilter.analysisInstrument")),
37 SAMPLING_EQUIPMENT(FilterTypeId.SAMPLING_EQUIPMENT, n("dali.core.enums.contextFilter.samplingEquipment")),
38 TAXON_GROUP(FilterTypeId.TAXON_GROUP, n("dali.core.enums.contextFilter.taxonGroup")),
39 LOCATION(FilterTypeId.MONITORING_LOCATION, n("dali.core.enums.contextFilter.location")),
40 PROGRAM(FilterTypeId.PROGRAM, n("dali.core.enums.contextFilter.program")),
41 PMFM(FilterTypeId.PMFM, n("dali.core.enums.contextFilter.pmfm")),
42 DEPARTMENT(FilterTypeId.DEPARTMENT, n("dali.core.enums.contextFilter.department")),
43 TAXON(FilterTypeId.TAXON_NAME, n("dali.core.enums.contextFilter.taxon")),
44 USER(FilterTypeId.QUSER, n("dali.core.enums.contextFilter.user")),
45 CAMPAIGN(FilterTypeId.CAMPAIGN, n("dali.core.enums.contextFilter.campaign"));
46
47 private final FilterTypeId filterTypeId;
48 private final String keyLabel;
49
50 FilterTypeValues(FilterTypeId filterType, String keyLabel) {
51 this.filterTypeId = filterType;
52 this.keyLabel = keyLabel;
53 }
54
55
56
57
58
59
60 public String getLabel() {
61 return t(this.keyLabel);
62 }
63
64
65
66
67
68
69 public Integer getFilterTypeId() {
70 return this.filterTypeId != null ? this.filterTypeId.getValue() : -1;
71 }
72
73
74
75
76
77
78
79 public static FilterTypeValues getFilterType(final Integer filterTypeId) {
80 for (final FilterTypeValues filterType : values()) {
81 if (filterType.getFilterTypeId().equals(filterTypeId)) {
82 return filterType;
83 }
84 }
85 return null;
86 }
87 }