1 package fr.ifremer.reefdb.service.rulescontrol;
2
3 /*-
4 * #%L
5 * Reef DB :: Core
6 * %%
7 * Copyright (C) 2014 - 2018 Ifremer
8 * %%
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * #L%
22 */
23
24 import fr.ifremer.quadrige3.core.ProgressionCoreModel;
25 import fr.ifremer.reefdb.dto.configuration.control.ControlRuleDTO;
26 import fr.ifremer.reefdb.dto.data.survey.SurveyDTO;
27 import org.springframework.security.access.prepost.PreAuthorize;
28 import org.springframework.transaction.annotation.Transactional;
29
30 import java.util.Collection;
31
32 /**
33 * Rules control service.
34 *
35 * @author peck7 on 04/07/2018.
36 */
37 public interface ControlRuleService {
38
39 /**
40 * <p>controlSurveys.</p>
41 *
42 * @param surveys a {@link Collection} object.
43 * @param updateControlDateWhenSucceed Should update control date, when control succeed for a survey ?
44 * @param resetControlDateWhenFailed Should reset to NULL the control date, when control failed for a survey ?
45 * @param progressionModel progression model
46 * @return a {@link fr.ifremer.reefdb.service.rulescontrol.ControlRuleMessagesBean} object.
47 */
48 @Transactional()
49 @PreAuthorize("hasPermission(null, T(fr.ifremer.quadrige3.core.security.QuadrigeUserAuthority).USER)")
50 ControlRuleMessagesBean controlSurveys(Collection<? extends SurveyDTO> surveys,
51 boolean updateControlDateWhenSucceed,
52 boolean resetControlDateWhenFailed,
53 ProgressionCoreModel progressionModel);
54
55 /**
56 * <p>controlSurvey.</p>
57 *
58 * @param survey a {@link fr.ifremer.reefdb.dto.data.survey.SurveyDTO} object.
59 * @param updateControlDateWhenSucceed Should update control date, when control succeed ?
60 * @param resetControlDateWhenFailed Should reset to NULL the control date, when control failed ?
61 * @return a {@link fr.ifremer.reefdb.service.rulescontrol.ControlRuleMessagesBean} object.
62 */
63 @Transactional()
64 @PreAuthorize("hasPermission(null, T(fr.ifremer.quadrige3.core.security.QuadrigeUserAuthority).USER)")
65 ControlRuleMessagesBean controlSurvey(SurveyDTO survey,
66 boolean updateControlDateWhenSucceed,
67 boolean resetControlDateWhenFailed);
68
69 /**
70 * Control a object
71 *
72 * @param rule the rule
73 * @param objectToControl the object to control against the rule
74 * @return true is the rule accept the object
75 */
76 boolean controlUniqueObject(ControlRuleDTO rule, Object objectToControl);
77
78 }