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