View Javadoc
1   package fr.ifremer.reefdb.dao.system.filter;
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.quadrige3.core.dao.system.filter.Filter;
27  import fr.ifremer.reefdb.dto.configuration.filter.FilterDTO;
28  import org.springframework.cache.annotation.CacheEvict;
29  import org.springframework.cache.annotation.Cacheable;
30  
31  import java.util.List;
32  
33  /**
34   * <p>ReefDbFilterDao interface.</p>
35   *
36   * @author Ludovic
37   */
38  public interface ReefDbFilterDao {
39  
40      String ALL_FILTERS_CACHE = "all_filters";
41      String FILTER_BY_ID_CACHE = "filter_by_id";
42      String FILTERED_ELEMENTS_BY_FILTER_ID_CACHE = "filtered_elements_by_filter_id";
43  
44      /**
45       * <p>getAllContextFilters.</p>
46       *
47       * @param contextId a {@link java.lang.Integer} object.
48       * @param filterTypeId a {@link java.lang.Integer} object.
49       * @return a {@link java.util.List} object.
50       */
51      @Cacheable(value = ALL_FILTERS_CACHE)
52      List<FilterDTO> getAllContextFilters(Integer contextId, Integer filterTypeId);
53  
54      /**
55       * <p>getAllExtractionFilters.</p>
56       *
57       * @param filterTypeId a {@link java.lang.Integer} object.
58       * @return a {@link java.util.List} object.
59       */
60      List<FilterDTO> getAllExtractionFilters(Integer filterTypeId);
61  
62      /**
63       * <p>getFilterById.</p>
64       *
65       * @param filterId a {@link java.lang.Integer} object.
66       * @return a {@link fr.ifremer.reefdb.dto.configuration.filter.FilterDTO} object.
67       */
68      @Cacheable(value = FILTER_BY_ID_CACHE)
69      FilterDTO getFilterById(Integer filterId);
70  
71      /**
72       * <p>getFilteredElementsByFilterId.</p>
73       *
74       * @param filterId a {@link java.lang.Integer} object.
75       * @return a {@link java.util.List} object.
76       */
77      @Cacheable(value = FILTERED_ELEMENTS_BY_FILTER_ID_CACHE)
78      List<String> getFilteredElementsByFilterId(Integer filterId);
79  
80      /**
81       * <p>saveFilter.</p>
82       *
83       * @param filter a {@link fr.ifremer.reefdb.dto.configuration.filter.FilterDTO} object.
84       * @param quserId a int.
85       * @return a {@link fr.ifremer.quadrige3.core.dao.system.filter.Filter} object.
86       */
87      @CacheEvict(value = {
88              ALL_FILTERS_CACHE,
89              FILTER_BY_ID_CACHE,
90              FILTERED_ELEMENTS_BY_FILTER_ID_CACHE}, allEntries = true)
91      Filter saveFilter(FilterDTO filter, int quserId);
92  
93      /**
94       * <p>deleteFilters.</p>
95       *
96       * @param filterIds a {@link java.util.List} object.
97       */
98      @CacheEvict(value = {
99              ALL_FILTERS_CACHE,
100             FILTER_BY_ID_CACHE,
101             FILTERED_ELEMENTS_BY_FILTER_ID_CACHE}, allEntries = true)
102     void deleteFilters(List<Integer> filterIds);
103 
104     /**
105      * <p>checkFiltersNotUsedInContext.</p>
106      *
107      * @param filterIds a {@link java.util.List} object.
108      * @return a boolean.
109      */
110     boolean checkFiltersNotUsedInContext(List<Integer> filterIds);
111 
112 }