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.quadrige3.core.dao.data.survey.SurveyExtendDao;
27  import fr.ifremer.dali.dto.data.survey.SurveyDTO;
28  import fr.ifremer.dali.dto.referential.PersonDTO;
29  import fr.ifremer.dali.dto.system.QualificationHistoryDTO;
30  import fr.ifremer.dali.dto.system.ValidationHistoryDTO;
31  
32  import java.util.Collection;
33  import java.util.Date;
34  import java.util.List;
35  
36  /**
37   * <p>DaliSurveyDao interface.</p>
38   *
39   * @author Ludovic
40   */
41  public interface DaliSurveyDao extends SurveyExtendDao {
42  
43      /**
44       * Get all survey corresponding on search parameters If a parameter is null, it means no filter on this criteria
45       *  @param campaignId  the campaign id to filter
46       * @param programCodes the program code to filter
47       * @param locationId  the monitoring location id to filter
48       * @param name        the survey name (=mnemonic)
49       * @param comment     a {@link String} object.
50       * @param stateId     the state id to filter
51       * @param sharingId   the sharing id to filter
52       * @param startDate   the start date to filter
53       * @param endDate     the end date to filter
54       * @param strictDate  the indicator for date filtering
55  *                    <p>
56  *                    if strictDate is <ul>
57  *                    <li><b>false</b>: 'moreOrEquals' used for startDate, 'lessOrEquals' used for endDate<br>only if startDate or endDate not null.</li>
58  *                    <li><b>true</b>: 'more' used for startDate, 'less' used for endDate<br>only if startDate or endDate not null.</li></ul>
59  *                    Note : if startDate and endDate are both not null and equals, the 'equals' is used if they are not equals, the 'between' is used, regardless
60  *                    strictDate</p>       @return a {@link List} object.
61       */
62      List<SurveyDTO> getSurveysByCriteria(
63              Integer campaignId,
64              Collection<String> programCodes,
65              Integer locationId,
66              String name, String comment,
67              Integer stateId,
68              Integer sharingId,
69              Date startDate,
70              Date endDate,
71              boolean strictDate);
72  
73      /**
74       * <p>countSurveysWithProgramAndLocations.</p>
75       *
76       * @param programCode a {@link java.lang.String} object.
77       * @param locationIds a {@link java.util.List} object.
78       * @return a {@link java.lang.Long} object.
79       */
80      long countSurveysWithProgramAndLocations(String programCode, List<Integer> locationIds);
81  
82      long countSurveysWithProgramLocationAndOutsideDates(String programCode, int appliedStrategyId, int locationId, Date startDate, Date endDate);
83  
84      long countSurveysWithProgramLocationAndInsideDates(String programCode, int appliedStrategyId, int locationId, Date startDate, Date endDate);
85  
86      /**
87       * Get a full survey by its Id
88       *
89       * @param surveyId        a int.
90       * @param dontExcludePmfm a boolean.
91       * @return a {@link fr.ifremer.dali.dto.data.survey.SurveyDTO} object.
92       */
93      SurveyDTO getSurveyById(int surveyId, boolean dontExcludePmfm);
94  
95      /**
96       * Get the observer list of a survey
97       * <p>
98       * Used for convenience access to this list without full survey load
99       *
100      * @param surveyId a int.
101      * @return a {@link java.util.List} object.
102      */
103     List<PersonDTO> getObservers(int surveyId);
104 
105     /**
106      * Save a survey
107      *
108      * @param bean the survey bean to create
109      * @return the created bean
110      */
111     SurveyDTO save(SurveyDTO bean);
112 
113     /**
114      * Remove a list of survey
115      *
116      * @param surveyIds a {@link java.util.List} object.
117      */
118     void remove(List<Integer> surveyIds);
119 
120     /**
121      * <p>validate.</p>
122      *
123      * @param surveyId           a {@link Integer} object.
124      * @param validationComment  a {@link String} object.
125      * @param validationDate     a {@link Date} object.
126      * @param validatorId        a {@link Integer} object.
127      * @param readyToSynchronize a boolean.
128      */
129     void validate(int surveyId, String validationComment, Date validationDate, Integer validatorId, boolean readyToSynchronize);
130 
131     /**
132      * <p>unvalidate.</p>
133      *
134      * @param surveyId            a {@link Integer} object.
135      * @param unvalidationComment a {@link String} object.
136      * @param unvalidationDate    the unvalidation date
137      * @param validatorId         a {@link Integer} object.
138      */
139     void unvalidate(int surveyId, String unvalidationComment, Date unvalidationDate, Integer validatorId);
140 
141     void qualify(int surveyId, String qualificationComment, Date qualificationDate, Integer validatorId, String qualityFlagCode);
142 
143     List<ValidationHistoryDTO> getValidationHistory(int surveyId);
144 
145     List<QualificationHistoryDTO> getQualificationHistory(int surveyId);
146 
147     /**
148      * <p>updateSurveysControlDate.</p>
149      *
150      * @param surveyIds   a {@link java.util.Collection} object.
151      * @param controlDate a {@link java.util.Date} object.
152      */
153     void updateSurveysControlDate(Collection<Integer> surveyIds, Date controlDate);
154 
155 }