View Javadoc
1   package fr.ifremer.reefdb.dao.referential.pmfm;
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.quadrige3.core.dao.referential.pmfm.QualitativeValueDao;
28  import fr.ifremer.reefdb.dto.referential.pmfm.QualitativeValueDTO;
29  import org.springframework.cache.annotation.Cacheable;
30  
31  import java.util.List;
32  
33  /**
34   * Created by Ludovic on 22/09/2015.
35   */
36  public interface ReefDbQualitativeValueDao extends QualitativeValueDao {
37  
38      String QUALITATIVE_VALUE_BY_ID_CACHE = "qualitative_value_by_id";
39      String QUALITATIVE_VALUES_BY_PARAMETER_CODE_CACHE = "qualitative_values_by_parameter_code";
40      String QUALITATIVE_VALUES_BY_PMFM_ID_CACHE = "qualitative_values_by_pmfm_id";
41  
42      /**
43       * <p>getQualitativeValueById.</p>
44       *
45       * @param qualitativeValueId a int.
46       * @return a {@link fr.ifremer.reefdb.dto.referential.pmfm.QualitativeValueDTO} object.
47       */
48      @Cacheable(value = QUALITATIVE_VALUE_BY_ID_CACHE)
49      QualitativeValueDTO getQualitativeValueById(int qualitativeValueId);
50  
51      /**
52       * <p>getQualitativeValuesByPmfmId.</p>
53       *
54       * @param pmfmId a {@link java.lang.Integer} object.
55       * @return a {@link java.util.List} object.
56       */
57      @Cacheable(value = QUALITATIVE_VALUES_BY_PMFM_ID_CACHE)
58      List<QualitativeValueDTO> getQualitativeValuesByPmfmId(Integer pmfmId);
59  
60      /**
61       * <p>getQualitativeValuesByParameterCode.</p>
62       *
63       * @param parameterCode a {@link java.lang.String} object.
64       * @return a {@link java.util.List} object.
65       */
66      @Cacheable(value = QUALITATIVE_VALUES_BY_PARAMETER_CODE_CACHE)
67      List<QualitativeValueDTO> getQualitativeValuesByParameterCode(String parameterCode);
68  
69      // no cache eviction here because this method is called by ReefDbParameterDao.saveParameter(...)
70      /**
71       * <p>saveQualitativeValue.</p>
72       *
73       * @param parameterCode a {@link java.lang.String} object.
74       * @param qualitativeValue a {@link fr.ifremer.reefdb.dto.referential.pmfm.QualitativeValueDTO} object.
75       */
76      void saveQualitativeValue(String parameterCode, QualitativeValueDTO qualitativeValue);
77  }