View Javadoc
1   package fr.ifremer.reefdb.dao.referential.pmfm;
2   
3   /*
4    * #%L
5    * Reef DB :: Core
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2014 - 2015 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
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   * <p>ReefDbPmfmDao interface.</p>
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       * <p>getAllPmfms.</p>
45       *
46       * @param statusCodes a {@link java.util.List} object.
47       * @return a {@link java.util.List} object.
48       */
49      @Cacheable(value = ALL_PMFMS_CACHE)
50      List<PmfmDTO> getAllPmfms(List<String> statusCodes);
51  
52      /**
53       * <p>getPmfmById.</p>
54       *
55       * @param pmfmId a int.
56       * @return a {@link fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO} object.
57       */
58      @Cacheable(value = PMFM_BY_ID_CACHE)
59      PmfmDTO getPmfmById(int pmfmId);
60  
61      /**
62       * <p>getPmfmsByIds.</p>
63       *
64       * @param pmfmIds a {@link java.util.List} object.
65       * @return a {@link java.util.List} object.
66       */
67      @Cacheable(value = PMFMS_BY_IDS_CACHE)
68      List<PmfmDTO> getPmfmsByIds(List<Integer> pmfmIds);
69  
70      /**
71       * <p>findPmfms.</p>
72       *
73       * @param parameterCode a {@link String} object.
74       * @param matrixId a {@link Integer} object.
75       * @param fractionId a {@link Integer} object.
76       * @param methodId a {@link Integer} object.
77       * @param pmfmName a {@link String} object.
78       * @param statusCodes a {@link List} object.
79       * @return a {@link java.util.List} object.
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       * <p>savePmfms.</p>
86       *
87       * @param pmfms a {@link java.util.List} object.
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       * <p>deletePmfms.</p>
100      *
101      * @param pmfmIds a {@link java.util.List} object.
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      * <p>replaceTemporaryPmfm.</p>
114      *
115      * @param sourceId a {@link java.lang.Integer} object.
116      * @param targetId a {@link java.lang.Integer} object.
117      * @param delete a boolean.
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      * <p>isPmfmUsedInData.</p>
130      *
131      * @param pmfmId a int.
132      * @return a boolean.
133      */
134     boolean isPmfmUsedInData(int pmfmId);
135 
136     /**
137      * <p>isPmfmUsedInValidatedData.</p>
138      *
139      * @param pmfmId a int.
140      * @return a boolean.
141      */
142     boolean isPmfmUsedInValidatedData(int pmfmId);
143 
144     /**
145      * <p>isPmfmUsedInProgram.</p>
146      *
147      * @param pmfmId a int.
148      * @return a boolean.
149      */
150     boolean isPmfmUsedInProgram(int pmfmId);
151 
152     /**
153      * <p>isPmfmUsedInRules.</p>
154      *
155      * @param pmfmId a int.
156      * @return a boolean.
157      */
158     boolean isPmfmUsedInRules(int pmfmId);
159 }