1 package fr.ifremer.reefdb.dao.system.context; 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 27 import fr.ifremer.reefdb.dao.system.filter.ReefDbFilterDao; 28 import fr.ifremer.reefdb.dto.configuration.context.ContextDTO; 29 import org.springframework.cache.annotation.CacheEvict; 30 import org.springframework.cache.annotation.Cacheable; 31 32 import java.util.List; 33 34 /** 35 * <p>ReefDbContextDao interface.</p> 36 * 37 * @author Ludovic 38 */ 39 public interface ReefDbContextDao { 40 41 String ALL_CONTEXT_CACHE = "all_context"; 42 String CONTEXT_BY_ID_CACHE = "context_by_id"; 43 44 /** 45 * <p>getAllContext.</p> 46 * 47 * @return a {@link java.util.List} object. 48 */ 49 @Cacheable(value = ALL_CONTEXT_CACHE) 50 List<ContextDTO> getAllContext(); 51 52 /** 53 * <p>getContextById.</p> 54 * 55 * @param contextId a {@link java.lang.Integer} object. 56 * @return a {@link fr.ifremer.reefdb.dto.configuration.context.ContextDTO} object. 57 */ 58 @Cacheable(value = CONTEXT_BY_ID_CACHE) 59 ContextDTO getContextById(Integer contextId); 60 61 /** 62 * <p>saveContext.</p> 63 * 64 * @param context a {@link ContextDTO} object. 65 * @return a {@link fr.ifremer.reefdb.dto.configuration.context.ContextDTO} object. 66 */ 67 @CacheEvict(value = { 68 ALL_CONTEXT_CACHE, 69 CONTEXT_BY_ID_CACHE, 70 ReefDbFilterDao.ALL_FILTERS_CACHE}, allEntries = true) 71 void saveContext(ContextDTO context); 72 73 /** 74 * <p>deleteContexts.</p> 75 * 76 * @param contextIds a {@link java.util.List} object. 77 */ 78 @CacheEvict(value = { 79 ALL_CONTEXT_CACHE, 80 CONTEXT_BY_ID_CACHE, 81 ReefDbFilterDao.ALL_FILTERS_CACHE}, allEntries = true) 82 void deleteContexts(List<Integer> contextIds); 83 84 }