1 package fr.ifremer.quadrige2.core.dao.data.survey;
2
3 /*-
4 * #%L
5 * Quadrige2 Core :: Quadrige2 Client Core
6 * $Id:$
7 * $HeadURL:$
8 * %%
9 * Copyright (C) 2017 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.quadrige2.core.dao.system.synchronization.SynchronizationStatus;
27 import fr.ifremer.quadrige2.core.vo.data.survey.LightSurveyVO;
28
29 import java.util.Collection;
30 import java.util.List;
31
32 /**
33 * <p>
34 * SurveyExtendDao interface.
35 * </p>
36 *
37 */
38 public interface SurveyExtendDao extends SurveyDao {
39
40 /**
41 * Delete the survey direclty if data has never been synchronized (no remoteId)
42 * else by DeletedItemHistory
43 *
44 * @param surveyId
45 * a int.
46 * @param recorderPersonId
47 * mandatory if the data has been synchronized. Used to fill DeletedItemHistory.recorderPerson
48 */
49 void removeUsingDeletedItemHistory(int surveyId, Integer recorderPersonId);
50
51 /**
52 * <p>
53 * removeByIds.
54 * </p>
55 *
56 * @param ids
57 * a {@link java.util.Collection} object.
58 */
59 void removeByIds(Collection<Integer> ids);
60
61 /**
62 * <p>
63 * updateSynchronizationStatus.
64 * </p>
65 *
66 * @param surveyId
67 * a int.
68 * @param synchronizationStatus
69 * a {@link fr.ifremer.quadrige2.core.dao.system.synchronization.SynchronizationStatus} object.
70 * @return a int.
71 */
72 int updateSynchronizationStatus(int surveyId, SynchronizationStatus synchronizationStatus);
73
74 /**
75 * <p>
76 * updateSynchronizationStatus.
77 * </p>
78 *
79 * @param surveyIds
80 * a {@link java.util.List} object.
81 * @param synchronizationStatus
82 * a {@link fr.ifremer.quadrige2.core.dao.system.synchronization.SynchronizationStatus} object.
83 * @return a int.
84 */
85 int updateSynchronizationStatus(List<Integer> surveyIds, SynchronizationStatus synchronizationStatus);
86
87 /**
88 * Update HAS_MEAS flags on one survey. And optionnally on child sampling operation
89 *
90 * @param surveyId
91 * a int.
92 * @return updated rows count
93 */
94 int updateHasMeasFlag(int surveyId);
95
96 /**
97 * Update HAS_MEAS flags on a list of surveys. And optionnally on child sampling operation
98 *
99 * @return updated rows count
100 * @param surveyIds
101 * a {@link java.util.List} object.
102 */
103 int updateHasMeasFlag(List<Integer> surveyIds);
104
105 /**
106 * Apply the survey program to all children entities
107 * @param surveyId
108 */
109 void applySurveyProgramsToChildren(int surveyId);
110
111 /**
112 * <p>
113 * isReadyToSynchronizeStatusForRecorderPerson.
114 * </p>
115 *
116 * @param recorderPersonId
117 * a int.
118 * @return a boolean.
119 */
120 boolean isReadyToSynchronizeStatusForRecorderPerson(int recorderPersonId);
121
122 /**
123 * Return all observation not exportable, regarding to user access rights.
124 * <p/>
125 * (see mantis #22215)
126 *
127 * @param userId
128 * the connected user id
129 * @param fillObservers
130 * fill observers in the DTO ?
131 * @return a {@link java.util.List} object.
132 */
133 List<Survey> getNotExportableSurveysByUserId(int userId, boolean fillObservers);
134
135 /**
136 * Return all observation set as dirty, older than <code>minYearOld</code>, and with access right for the given
137 * <code>personId</code>
138 * <p/>
139 * (see mantis Allegro-ObsDeb #22215)
140 *
141 * @param userId
142 * a int.
143 * @param nbYearOld
144 * a int.
145 * @param fillObservers
146 * a boolean.
147 * @return a {@link java.util.List} object.
148 */
149 List<Survey> getOldDirtySurveysByUserId(int userId, int nbYearOld, boolean fillObservers);
150
151 /**
152 * Get IDs of observed locations that could be clean (ObservedLocation without ANY access rights on local DB)
153 *
154 * @return a {@link java.util.List} object.
155 */
156 List<Integer> getCleanableSurveyIds();
157
158 /**
159 * Get a light representation of a Survey.
160 *
161 * @param surveyId
162 * a int.
163 * @return a light value object
164 */
165 LightSurveyVO getLightSurveyById(int surveyId);
166 }