1 package fr.ifremer.reefdb.dao.referential.pmfm;
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.reefdb.dto.referential.pmfm.*;
27 import org.springframework.cache.annotation.CacheEvict;
28 import org.springframework.cache.annotation.Cacheable;
29
30 import java.util.List;
31
32
33
34
35
36 public interface ReefDbPmfmDao {
37
38 String ALL_PMFMS_CACHE = "all_pmfms";
39 String PMFM_BY_ID_CACHE = "pmfm_by_id";
40 String PMFMS_BY_IDS_CACHE = "pmfms_by_ids";
41 String PMFMS_BY_CRITERIA_CACHE = "pmfms_by_criteria";
42
43
44
45
46
47
48
49 @Cacheable(value = ALL_PMFMS_CACHE)
50 List<PmfmDTO> getAllPmfms(List<String> statusCodes);
51
52
53
54
55
56
57
58 @Cacheable(value = PMFM_BY_ID_CACHE)
59 PmfmDTO getPmfmById(int pmfmId);
60
61
62
63
64
65
66
67 @Cacheable(value = PMFMS_BY_IDS_CACHE)
68 List<PmfmDTO> getPmfmsByIds(List<Integer> pmfmIds);
69
70
71
72
73
74
75
76
77
78
79
80
81 @Cacheable(value = PMFMS_BY_CRITERIA_CACHE)
82 List<PmfmDTO> findPmfms(String parameterCode, Integer matrixId, Integer fractionId, Integer methodId, Integer unitId, String pmfmName, List<String> statusCodes);
83
84
85
86
87
88
89 @CacheEvict(value = {
90 ALL_PMFMS_CACHE,
91 PMFM_BY_ID_CACHE,
92 PMFMS_BY_IDS_CACHE,
93 PMFMS_BY_CRITERIA_CACHE,
94 ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PMFM_ID_CACHE
95 }, allEntries = true)
96 void savePmfms(List<? extends PmfmDTO> pmfms);
97
98
99
100
101
102
103 @CacheEvict(value = {
104 ALL_PMFMS_CACHE,
105 PMFM_BY_ID_CACHE,
106 PMFMS_BY_IDS_CACHE,
107 PMFMS_BY_CRITERIA_CACHE,
108 ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PMFM_ID_CACHE
109 }, allEntries = true)
110 void deletePmfms(List<Integer> pmfmIds);
111
112
113
114
115
116
117
118
119 @CacheEvict(value = {
120 ALL_PMFMS_CACHE,
121 PMFM_BY_ID_CACHE,
122 PMFMS_BY_IDS_CACHE,
123 PMFMS_BY_CRITERIA_CACHE,
124 ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PMFM_ID_CACHE
125 }, allEntries = true)
126 void replaceTemporaryPmfm(Integer sourceId, Integer targetId, boolean delete);
127
128
129
130
131
132
133
134 boolean isPmfmUsedInData(int pmfmId);
135
136
137
138
139
140
141
142 boolean isPmfmUsedInValidatedData(int pmfmId);
143
144
145
146
147
148
149
150 boolean isPmfmUsedInProgram(int pmfmId);
151
152
153
154
155
156
157
158 boolean isPmfmUsedInRules(int pmfmId);
159 }