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