Package org.drools.decisiontable.parser
Class DefaultRuleSheetListener
- java.lang.Object
-
- org.drools.decisiontable.parser.DefaultRuleSheetListener
-
- All Implemented Interfaces:
RuleSheetListener,org.drools.template.parser.DataListener
- Direct Known Subclasses:
RuleMatrixSheetListener
public class DefaultRuleSheetListener extends java.lang.Object implements RuleSheetListener
An object of this class is prepared to receive calls passing it the contents of a spreadsheet containing one or more decision tables. Each of these tables is then expanded into a set of similar rules, varying to a degree with respect to the patterns and actions. A "rule set" starts with some overall definitions such as imports, globals, functions and queries. A table is identifed by a cell beginning with the text "RuleTable". The first row after the table identifier defines the column type: either a pattern of the condition or an action for the consequence, or an attribute. The second row contains optional pattern type declarations. If cells in this row are merged, then all snippets below the merged stretch become part of the same pattern, as separate constraints. The third row identifies the java code block associated with the condition or consequence. This code block should include one or more parameter markers for the insertion of values defined in cells of that column. The third row is available for comments on the purpose of the column. All subsequent rows identify rules with the set, providing values to be inserted where there are markers in the code snippets defined in the third row, or for the attribute identified by the column header. href="mailto:michael.neale@gmail.com"> Michael Neale
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDECLARES_TAGstatic java.lang.StringDIALECT_TAGstatic java.lang.StringESCAPE_QUOTES_FLAGstatic java.lang.StringFUNCTIONS_TAGstatic java.lang.StringIGNORE_NUMERIC_FORMAT_FLAGstatic java.lang.StringIMPORT_TAGstatic java.lang.StringMAX_SALIENCE_TAGstatic java.lang.StringMIN_SALIENCE_TAGstatic java.lang.StringNUMERIC_DISABLED_FLAGstatic java.lang.StringQUERIES_TAGstatic java.lang.StringRULE_TABLE_TAGstatic java.lang.StringRULESET_TAGstatic java.lang.StringSEQUENTIAL_FLAGstatic java.lang.StringUNIT_TAGstatic java.lang.StringVARIABLES_TAG
-
Constructor Summary
Constructors Constructor Description DefaultRuleSheetListener()Constructor.DefaultRuleSheetListener(boolean showPackage, boolean trimCell)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddRule(org.drools.template.model.Rule newRule)Add a new rule to the current list of rulesbooleandoesIgnoreNumericFormat()voidfinishSheet()protected org.drools.template.model.RulegetCurrentRule()PropertiesSheetListener.CaseInsensitiveMapgetProperties()Return the rule sheet propertiesorg.drools.template.model.PackagegetRuleSet()Build the final ruleset as parsed.booleanisNumericDisabled()voidnewCell(int row, int column, java.lang.String value, int mergedColStart)voidnewRow(int rowNumber, int columns)protected voidpostInitRuleTable(int row, int column, java.lang.String value)Called after rule table initialisation.protected voidpreInitRuleTable(int row, int column, java.lang.String value)Called before rule table initialisation.voidsetWorksheetName(java.lang.String worksheetName)voidstartSheet(java.lang.String name)
-
-
-
Field Detail
-
QUERIES_TAG
public static final java.lang.String QUERIES_TAG
- See Also:
- Constant Field Values
-
FUNCTIONS_TAG
public static final java.lang.String FUNCTIONS_TAG
- See Also:
- Constant Field Values
-
DECLARES_TAG
public static final java.lang.String DECLARES_TAG
- See Also:
- Constant Field Values
-
UNIT_TAG
public static final java.lang.String UNIT_TAG
- See Also:
- Constant Field Values
-
IMPORT_TAG
public static final java.lang.String IMPORT_TAG
- See Also:
- Constant Field Values
-
SEQUENTIAL_FLAG
public static final java.lang.String SEQUENTIAL_FLAG
- See Also:
- Constant Field Values
-
ESCAPE_QUOTES_FLAG
public static final java.lang.String ESCAPE_QUOTES_FLAG
- See Also:
- Constant Field Values
-
MIN_SALIENCE_TAG
public static final java.lang.String MIN_SALIENCE_TAG
- See Also:
- Constant Field Values
-
MAX_SALIENCE_TAG
public static final java.lang.String MAX_SALIENCE_TAG
- See Also:
- Constant Field Values
-
NUMERIC_DISABLED_FLAG
public static final java.lang.String NUMERIC_DISABLED_FLAG
- See Also:
- Constant Field Values
-
IGNORE_NUMERIC_FORMAT_FLAG
public static final java.lang.String IGNORE_NUMERIC_FORMAT_FLAG
- See Also:
- Constant Field Values
-
VARIABLES_TAG
public static final java.lang.String VARIABLES_TAG
- See Also:
- Constant Field Values
-
RULE_TABLE_TAG
public static final java.lang.String RULE_TABLE_TAG
- See Also:
- Constant Field Values
-
RULESET_TAG
public static final java.lang.String RULESET_TAG
- See Also:
- Constant Field Values
-
DIALECT_TAG
public static final java.lang.String DIALECT_TAG
- See Also:
- Constant Field Values
-
-
Method Detail
-
setWorksheetName
public void setWorksheetName(java.lang.String worksheetName)
-
getProperties
public PropertiesSheetListener.CaseInsensitiveMap getProperties()
Description copied from interface:RuleSheetListenerReturn the rule sheet properties- Specified by:
getPropertiesin interfaceRuleSheetListener
-
getRuleSet
public org.drools.template.model.Package getRuleSet()
Description copied from interface:RuleSheetListenerBuild the final ruleset as parsed.- Specified by:
getRuleSetin interfaceRuleSheetListener
-
addRule
protected void addRule(org.drools.template.model.Rule newRule)
Add a new rule to the current list of rules- Parameters:
newRule-
-
startSheet
public void startSheet(java.lang.String name)
- Specified by:
startSheetin interfaceorg.drools.template.parser.DataListener
-
finishSheet
public void finishSheet()
- Specified by:
finishSheetin interfaceorg.drools.template.parser.DataListener
-
newRow
public void newRow(int rowNumber, int columns)- Specified by:
newRowin interfaceorg.drools.template.parser.DataListener
-
newCell
public void newCell(int row, int column, java.lang.String value, int mergedColStart)- Specified by:
newCellin interfaceorg.drools.template.parser.DataListener
-
preInitRuleTable
protected void preInitRuleTable(int row, int column, java.lang.String value)Called before rule table initialisation. Subclasses may override this method to do additional processing.
-
getCurrentRule
protected org.drools.template.model.Rule getCurrentRule()
-
postInitRuleTable
protected void postInitRuleTable(int row, int column, java.lang.String value)Called after rule table initialisation. Subclasses may override this method to do additional processing.
-
isNumericDisabled
public boolean isNumericDisabled()
-
doesIgnoreNumericFormat
public boolean doesIgnoreNumericFormat()
-
-