public class RuleSystem extends Object implements Serializable
RuleSystem rs = new RuleSystem("rule system name");
Rule r = rs.getRule(25L);
| Constructor and Description |
|---|
RuleSystem(String ruleSystemName,
IDataProvider dataProvider)
This constructor initializes a rule system of the given name by reading data from the
credentials given in the data source URL.
|
RuleSystem(String ruleSystemName,
IDataProvider dataProvider,
RuleInputConfigurator inputConfig)
This constructor initializes a rule system of the given name by reading data from the
credentials given in the data source URL.
|
| Modifier and Type | Method and Description |
|---|---|
Rule |
addRule(Map<String,String> inputMap)
This method adds a new rule to the rule system.
|
Rule |
addRule(Rule newRule)
This method adds the given rule to the rule system with a new rule id.
|
Rule |
createRuleObject(Map<String,String> inputMap) |
boolean |
deleteRule(Rule rule)
This method deletes the given rule from the rule system.
|
boolean |
deleteRule(String ruleId)
This method deletes an existing rule from the rule system.
|
List<Rule> |
getAllApplicableRules(Map<String,String> inputMap)
This method returns a list of all the rules in the rule system.
|
List<String> |
getAllColumnNames()
Returns the names of all the columns in the rule system, including the unique
input and output column names
|
List<Rule> |
getAllRules()
This method returns a list of all the rules in the rule system.
|
List<Rule> |
getConflictingRules(Rule rule)
This method returns a list of rules conflicting with the given rule.
|
List<String> |
getInputColumnNames()
Returns the names of all the columns in the rule system, excluding the unique
input and output column names
|
RuleSystemMetaData |
getMetaData()
this method returns the metadata corresponding to this rule system.
|
String |
getName()
Returns the name of the rule system
|
Rule |
getNextApplicableRule(Map<String,String> inputMap)
This method returns the next rule that will be applicable to the inputs
if the current rule applicable to the were to be deleted.
|
String |
getOutputColumnName() |
Rule |
getRule(Map<String,String> inputMap)
This method returns the rule applicable for the given combination of rule
inputs.
|
Rule |
getRule(Object request)
This method returns the rule applicable for the given combination of rule
inputs.
|
Rule |
getRule(String ruleId)
This method returns the applicable rule for the given input criteria.
|
String |
getUniqueColumnName() |
Rule |
updateRule(Rule oldRule,
Rule newRule)
This method updates an existing rules with values of the new rule given.
|
public RuleSystem(String ruleSystemName, IDataProvider dataProvider) throws Exception
ruleSystemName - Name of the rule system to be instantiateddataProvider - Exception - on rule system initialization failurepublic RuleSystem(String ruleSystemName, IDataProvider dataProvider, RuleInputConfigurator inputConfig) throws Exception
ruleSystemName - Name of the rule system to be instantiateddataProvider - inputConfig - Configuration to support custom data types and behaviour for rule inputsException - if rule system could not be initializedpublic Rule createRuleObject(Map<String,String> inputMap) throws Exception
Exceptionpublic List<Rule> getAllRules()
public List<Rule> getAllApplicableRules(Map<String,String> inputMap) throws Exception
inputMap - map of rule input values for which applicable rules are to be returnedException - if rule evaluation failspublic Rule getRule(Object request) throws Exception
request - A simple Object with @RuletteInput annotation on required fields
valuesException - on rule evaluation errorpublic Rule getRule(Map<String,String> inputMap) throws Exception
inputMap - Map with input names as keys and their String values as
valuesException - on rule evaluation errorpublic Rule getRule(String ruleId)
ruleId - Unique id of the rule to get looked up.Rule object if a rule with the given id exists. null
otherwise.public Rule addRule(Map<String,String> inputMap) throws Exception
inputMap - The rule input values for which a new rule is to be addedException - on failurepublic Rule addRule(Rule newRule) throws Exception
newRule - The new rule to be addedException - on failurepublic Rule updateRule(Rule oldRule, Rule newRule) throws Exception
oldRule - An existing rulenewRule - The rule containing the new field values to which the old
rule will be updated.Exception - if there are overlapping rules if the old rules does
not actually exist.public boolean deleteRule(String ruleId) throws Exception
ruleId - Unique id of the rule to be deletedException - on error in deleting rulepublic boolean deleteRule(Rule rule) throws Exception
public List<Rule> getConflictingRules(Rule rule) throws Exception
public Rule getNextApplicableRule(Map<String,String> inputMap) throws Exception
inputMap - Map with column Names as keys and column values as
values.Rule object if a rule is applicable after the currently
applicable rule is deleted. null if no rule is applicable after the
currently applicable rule is deleted. null id no rule is currently
applicable.Exception - on rule evaluation failurepublic String getUniqueColumnName()
public String getOutputColumnName()
public String getName()
public List<String> getAllColumnNames()
public List<String> getInputColumnNames()
public RuleSystemMetaData getMetaData() throws Exception
RuleSystemMetaData for this rule systemExceptionCopyright © 2020. All rights reserved.