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.*;
14
15
16
17
18 public class PatronAllChargesRuleFormulator extends RuleFormulatorUtil implements RuleFormulator {
19 @Override
20 public Map formulateRuleMap(DroolsRuleBo droolsRuleBo) {
21 return super.formulateRule(droolsRuleBo);
22 }
23
24 @Override
25 public String formulateRules(DroolsRuleBo droolsRuleBo) {
26 return "";
27 }
28
29 @Override
30 protected String getTemplateFileName() {
31 return "general-checks/all-charges.txt";
32 }
33
34 @Override
35 protected void processExtraRules(DroolsRuleBo droolsRuleBo, Map map) {
36 FinesAndLimitsBo finesAndLimitsBo = droolsRuleBo.getFinesAndLimitsBo();
37 StringBuilder stringBuilder = new StringBuilder();
38 Object patronAllCharges = finesAndLimitsBo.getLimitAmount();
39 stringBuilder.append(patronAllCharges);
40 map.put("allCharges", stringBuilder.toString());
41
42 stringBuilder = new StringBuilder();
43 String borrowerTypes = finesAndLimitsBo.getBorrowerType();
44 if (StringUtils.isNotEmpty(borrowerTypes)) {
45 stringBuilder.append(processDataByDelimiter(borrowerTypes));
46 map.put("borrowerTypes", stringBuilder.toString());
47 map.put("operator", "in");
48 }
49
50 }
51
52 @Override
53 public boolean isInterested(String value) {
54 return false;
55 }
56
57 @Override
58 public boolean isInterestedForParameters(String value) {
59 return value.equals(DroolsConstants.GENERAL_CHECK_RULE_TYPE.ALL_CHARGES);
60 }
61
62 @Override
63 public boolean isInterestedForThenCustomRules(String value) {
64 return false;
65 }
66 }