View Javadoc
1   package org.kuali.ole.deliver.drools.rules;
2   
3   import org.apache.commons.io.FileUtils;
4   import org.apache.commons.lang3.StringUtils;
5   import org.kuali.ole.deliver.bo.drools.DroolsRuleBo;
6   import org.kuali.ole.deliver.bo.drools.FinesAndLimitsBo;
7   import org.kuali.ole.deliver.drools.DroolsConstants;
8   
9   import java.io.File;
10  import java.io.IOException;
11  import java.net.URISyntaxException;
12  import java.net.URL;
13  import java.util.HashMap;
14  import java.util.Iterator;
15  import java.util.List;
16  import java.util.Map;
17  
18  /**
19   * Created by pvsubrah on 7/9/15.
20   */
21  public class PatronRecallAndOverDueDaysRuleFormulator extends RuleFormulatorUtil implements RuleFormulator {
22      @Override
23      public Map formulateRuleMap(DroolsRuleBo droolsRuleBo) {
24          return super.formulateRule(droolsRuleBo);
25      }
26  
27      @Override
28      public String formulateRules(DroolsRuleBo droolsRuleBo) {
29          return "";
30      }
31  
32      @Override
33      protected String getTemplateFileName() {
34          return "general-checks/is-recalled-and-overdue.txt";
35      }
36  
37      @Override
38      protected void processExtraRules(DroolsRuleBo droolsRuleBo, Map map) {
39          FinesAndLimitsBo finesAndLimitsBo = droolsRuleBo.getFinesAndLimitsBo();
40          StringBuilder stringBuilder = new StringBuilder();
41          Object patronRecallAndOverdueDays = finesAndLimitsBo.getOverDueLimits();
42          stringBuilder.append(patronRecallAndOverdueDays);
43          map.put("isRecalledAndOverdue", stringBuilder.toString());
44      }
45  
46      @Override
47      public boolean isInterested(String value) {
48        return false;
49      }
50  
51      @Override
52      public boolean isInterestedForParameters(String value) {
53          return value.equals(DroolsConstants.GENERAL_CHECK_RULE_TYPE.RECALL_AND_OVERDUE_DAYS);
54      }
55  
56      @Override
57      public boolean isInterestedForThenCustomRules(String value) {
58          return false;
59      }
60  }