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.ParameterDTO;
27 import fr.ifremer.reefdb.dto.referential.pmfm.ParameterGroupDTO;
28 import org.springframework.cache.annotation.CacheEvict;
29 import org.springframework.cache.annotation.Cacheable;
30
31 import java.util.List;
32
33
34
35
36 public interface ReefDbParameterDao {
37
38 String PARAMETER_BY_CODE_CACHE = "parameter_by_code";
39 String ALL_PARAMETERS_CACHE = "all_parameters";
40
41 String ALL_PARAMETER_GROUPS_CACHE = "all_parameter_groups";
42 String PARAMETER_GROUP_BY_ID_CACHE = "parameter_group_by_id";
43
44
45
46
47
48
49
50 @Cacheable(value = ALL_PARAMETERS_CACHE)
51 List<ParameterDTO> getAllParameters(List<String> statusCodes);
52
53
54
55
56
57
58
59 @Cacheable(value = PARAMETER_BY_CODE_CACHE)
60 ParameterDTO getParameterByCode(String parameterCode);
61
62
63
64
65
66
67
68
69
70 List<ParameterDTO> findParameters(String parameterCode, Integer parameterGroupId, List<String> statusCodes);
71
72
73
74
75
76
77 @CacheEvict(value = {
78 PARAMETER_BY_CODE_CACHE,
79 ALL_PARAMETERS_CACHE,
80 ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PARAMETER_CODE_CACHE
81 }, allEntries = true)
82 void saveParameters(List<? extends ParameterDTO> parameters);
83
84
85
86
87
88
89 @CacheEvict(value = {
90 PARAMETER_BY_CODE_CACHE,
91 ALL_PARAMETERS_CACHE,
92 ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PARAMETER_CODE_CACHE
93 }, allEntries = true)
94 void deleteParameters(List<String> parametersCodes);
95
96
97
98
99
100
101
102
103 @CacheEvict(value = {
104 PARAMETER_BY_CODE_CACHE,
105 ALL_PARAMETERS_CACHE,
106 ReefDbQualitativeValueDao.QUALITATIVE_VALUES_BY_PARAMETER_CODE_CACHE
107 }, allEntries = true)
108 void replaceTemporaryParameter(String sourceCode, String targetCode, boolean delete);
109
110
111
112
113
114
115
116 boolean isParameterUsedInProgram(String parameterCode);
117
118
119
120
121
122
123
124 boolean isParameterUsedInRules(String parameterCode);
125
126
127
128
129
130
131
132 boolean isParameterUsedInReferential(String parameterCode);
133
134
135
136
137
138
139
140 @Cacheable(value = ALL_PARAMETER_GROUPS_CACHE)
141 List<ParameterGroupDTO> getAllParameterGroups(List<String> statusCodes);
142
143
144
145
146
147
148
149 @Cacheable(value = PARAMETER_GROUP_BY_ID_CACHE)
150 ParameterGroupDTO getParameterGroupById(int parameterGroupId);
151
152 }