View Javadoc
1   package fr.ifremer.dali.dao.data.survey;
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.dali.dao.administration.program.DaliProgramDao;
27  import fr.ifremer.dali.dao.referential.monitoringLocation.DaliMonitoringLocationDao;
28  import fr.ifremer.dali.dto.data.survey.CampaignDTO;
29  import fr.ifremer.dali.dto.data.survey.OccasionDTO;
30  import fr.ifremer.quadrige3.core.dao.data.survey.CampaignDao;
31  import org.springframework.cache.annotation.CacheEvict;
32  import org.springframework.cache.annotation.Cacheable;
33  
34  import java.util.Date;
35  import java.util.List;
36  
37  /**
38   * Campaigns DAO
39   *
40   * @author Ludovic
41   */
42  public interface DaliCampaignDao extends CampaignDao {
43  
44      String ALL_CAMPAIGNS_CACHE = "all_campaigns";
45  
46      /**
47       * Return the list of all campaigns
48       *
49       * @return a {@link java.util.List} object.
50       */
51      @Cacheable(value = ALL_CAMPAIGNS_CACHE)
52      List<CampaignDTO> getAllCampaigns();
53  
54      List<CampaignDTO> getCampaignsByIds(List<Integer> campaignIds);
55  
56      List<CampaignDTO> getCampaignsByCriteria(String name, Date startDate1, Date startDate2, boolean strictStartDate, Date endDate1, Date endDate2, boolean strictEndDate, boolean canEndDateBeNull);
57  
58      List<CampaignDTO> getCampaignsByName(String name);
59  
60      @CacheEvict(value = {
61              ALL_CAMPAIGNS_CACHE,
62              DaliProgramDao.PROGRAMS_BY_CAMPAIGN_ID_CACHE,
63              DaliMonitoringLocationDao.LOCATIONS_BY_CAMPAIGN_AND_PROGRAM_CACHE
64      }, allEntries = true)
65      void saveCampaign(CampaignDTO campaign);
66  
67      @CacheEvict(value = {
68              ALL_CAMPAIGNS_CACHE,
69              DaliProgramDao.PROGRAMS_BY_CAMPAIGN_ID_CACHE,
70              DaliMonitoringLocationDao.LOCATIONS_BY_CAMPAIGN_AND_PROGRAM_CACHE
71      }, allEntries = true)
72      @Override
73      void remove(Integer campaignId);
74  
75      /**
76       * Return the list of all occasions
77       *
78       * @return a {@link java.util.List} object.
79       */
80      List<OccasionDTO> getAllOccasions();
81  
82  }