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