Runtime components : Service components : Rule provider services : Extending the Java code rule provider service
  
Extending the Java code rule provider service
UNICOM® Digital Transformation Toolkit (UDTT™) provides an abstract service class--- JavaCodeRuleProviderService, and you can extend it for Remote ILog Service and Java Local Rule Service.
For Java Local Rule Service, you just need implement the abstract method checkRule() to do the rule judgment.
public class UserTransferRuleProviderExample extends JavaCodeRuleProviderService {
public Map<String, Object> checkRule(Map<String, Object> params) {
System.out.println("#######UserTransferRuleProviderExample checkRule for ruleID="+this.getRuleID());

if(getRuleID().equalsIgnoreCase("checkLimit")){
Double amount = (Double) params.get("amount");
Double limit = (Double) params.get("limit");

if(amount<=limit)
params.put("approve", new Boolean(true));
}
return null;
}
}
For Remote ILog Service, you need to implement the invoker process to the remote ILog server in checkRule() method.
Note When you connect to ILog server in J2EE module, you need to configure a resource-ref in Web project as following:
 
ParameterNames
Description
Mandatory
statusParamName
Parameter name of the status code of the report.
Y
toParamName
Parameter name of phone number to which message is sent.
N
messageIDParamName
Parameter name of message
Y
Go up to
Rule provider services