Class DefaultRuleSheetListener

  • All Implemented Interfaces:
    RuleSheetListener, org.drools.template.parser.DataListener
    Direct Known Subclasses:
    RuleMatrixSheetListener

    public class DefaultRuleSheetListener
    extends 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
    • Constructor Detail

      • DefaultRuleSheetListener

        public DefaultRuleSheetListener()
        Constructor.
      • DefaultRuleSheetListener

        public DefaultRuleSheetListener​(boolean showPackage,
                                        boolean trimCell)
        Constructor.
        Parameters:
        showPackage - if true, the rule set name is passed to the resulting package
    • Method Detail

      • setWorksheetName

        public void setWorksheetName​(String worksheetName)
      • 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​(String name)
        Specified by:
        startSheet in interface org.drools.template.parser.DataListener
      • finishSheet

        public void finishSheet()
        Specified by:
        finishSheet in interface org.drools.template.parser.DataListener
      • newRow

        public void newRow​(int rowNumber,
                           int columns)
        Specified by:
        newRow in interface org.drools.template.parser.DataListener
      • newCell

        public void newCell​(int row,
                            int column,
                            String value,
                            int mergedColStart)
        Specified by:
        newCell in interface org.drools.template.parser.DataListener
      • preInitRuleTable

        protected void preInitRuleTable​(int row,
                                        int column,
                                        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,
                                         String value)
        Called after rule table initialisation. Subclasses may override this method to do additional processing.
      • isNumericDisabled

        public boolean isNumericDisabled()
      • doesIgnoreNumericFormat

        public boolean doesIgnoreNumericFormat()