1 package fr.ifremer.reefdb.dao.system.rule;
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 import fr.ifremer.quadrige3.core.dao.system.rule.RuleDao;
24 import fr.ifremer.reefdb.dto.FunctionDTO;
25 import fr.ifremer.reefdb.dto.configuration.control.ControlRuleDTO;
26 import org.apache.commons.lang3.mutable.MutableBoolean;
27
28 import java.util.Date;
29 import java.util.List;
30
31 /**
32 * @author peck7 on 03/07/2018.
33 */
34 public interface ReefDbRuleDao extends RuleDao {
35
36 /**
37 * <p>getControlRulesByRuleListCode.</p>
38 *
39 * @param ruleListCode a {@link String} object.
40 * @param onlyActive a boolean.
41 * @param incompatibleRule a mutable boolean
42 * @return a {@link java.util.List} object.
43 */
44 List<ControlRuleDTO> getControlRulesByRuleListCode(String ruleListCode, boolean onlyActive, MutableBoolean incompatibleRule);
45
46 /**
47 * <p>getPreconditionedRulesByRuleListCode.</p>
48 *
49 * @param ruleListCode a {@link java.lang.String} object.
50 * @param onlyActive a boolean.
51 * @return a {@link java.util.List} object.
52 */
53 List<ControlRuleDTO> getPreconditionedRulesByRuleListCode(String ruleListCode, boolean onlyActive, MutableBoolean incompatibleRule);
54
55 /**
56 * Get grouped control rules
57 *
58 * @param ruleListCode
59 * @param onlyActive
60 * @param incompatibleRule
61 * @return
62 */
63 List<ControlRuleDTO> getGroupedRulesByRuleListCode(String ruleListCode, boolean onlyActive, MutableBoolean incompatibleRule);
64
65 /**
66 * <p>findActiveControlRules from 3 criteria: date, program code and department id</p>
67 * returns only active rules used for control (without preconditioned or grouped rules)
68 *
69 * @param date a {@link java.util.Date} object.
70 * @param programCode a {@link java.lang.String} object.
71 * @param departmentId a {@link java.lang.Integer} object.
72 * @return a {@link java.util.List} object.
73 */
74 List<ControlRuleDTO> findActiveControlRules(Date date, String programCode, Integer departmentId);
75
76 /**
77 * <p>findPreconditionedRules.</p>
78 *
79 * @param date a {@link java.util.Date} object.
80 * @param programCode a {@link java.lang.String} object.
81 * @param departmentId a {@link java.lang.Integer} object.
82 * @return a {@link java.util.List} object.
83 */
84 List<ControlRuleDTO> findActivePreconditionedRules(Date date, String programCode, Integer departmentId);
85
86 List<ControlRuleDTO> findActiveGroupedRules(Date date, String programCode, Integer departmentId);
87
88 /**
89 * <p>findPreconditionedRules.</p>
90 *
91 * @param programCodes a {@link java.util.List} object.
92 * @return a {@link java.util.List} object.
93 */
94 List<ControlRuleDTO> findActivePreconditionedRules(List<String> programCodes);
95
96 /**
97 * Save rule
98 *
99 * @param rule a {@link ControlRuleDTO} object.
100 */
101 void save(ControlRuleDTO rule, String ruleListCd);
102
103 /**
104 * <p>getAllFunction.</p>
105 *
106 * @return a {@link java.util.List} object.
107 */
108 List<FunctionDTO> getAllFunction();
109
110 boolean ruleExists(String ruleCode);
111
112 }