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