org.drools.template.model
Class Rule

java.lang.Object
  extended by org.drools.template.model.DRLElement
      extended by org.drools.template.model.AttributedDRLElement
          extended by org.drools.template.model.Rule
All Implemented Interfaces:
DRLJavaEmitter

public class Rule
extends AttributedDRLElement
implements DRLJavaEmitter

Represents a rule.


Constructor Summary
Rule(String name, Integer salience, int spreadsheetRow)
          Create a new rule.
 
Method Summary
 void addCondition(Condition con)
           
 void addConsequence(Consequence con)
           
 void addMetadata(String meta)
           
 void appendDescription(String value)
           
static int calcSalience(int rowNumber)
           
 List<Condition> getConditions()
           
 List<Consequence> getConsequences()
           
 List<String> getMetadata()
           
 String getName()
           
 int getSpreadsheetRowNumber()
           
 void renderDRL(DRLOutput out)
          Each node can add its contribution to the output
 void setDescription(String value)
           
 void setName(String value)
           
 
Methods inherited from class org.drools.template.model.AttributedDRLElement
asStringLiteral, getAttribute, getSalience, setActivationGroup, setAgendaGroup, setAutoFocus, setDuration, setLockOnActive, setNoLoop, setRuleFlowGroup, setSalience, setSalience
 
Methods inherited from class org.drools.template.model.DRLElement
setComment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rule

public Rule(String name,
            Integer salience,
            int spreadsheetRow)
Create a new rule. Note that the rule name should be post-fixed with the row number, as one way of providing tracability for errors back to the originating spreadsheet.

Parameters:
name - The name of the rule. This may be used to calculate DRL row error to Spreadsheet row error (just need to keep track of output lines, and map spreadsheetRow to a start and end range in the rendered output).
salience -
spreadsheetRow - The phyical row number from the spreadsheet.
Method Detail

addMetadata

public void addMetadata(String meta)

addCondition

public void addCondition(Condition con)

addConsequence

public void addConsequence(Consequence con)

renderDRL

public void renderDRL(DRLOutput out)
Description copied from interface: DRLJavaEmitter
Each node can add its contribution to the output

Specified by:
renderDRL in interface DRLJavaEmitter
Overrides:
renderDRL in class AttributedDRLElement

calcSalience

public static int calcSalience(int rowNumber)

getMetadata

public List<String> getMetadata()

getConditions

public List<Condition> getConditions()

getConsequences

public List<Consequence> getConsequences()

setName

public void setName(String value)

getName

public String getName()

setDescription

public void setDescription(String value)

appendDescription

public void appendDescription(String value)

getSpreadsheetRowNumber

public int getSpreadsheetRowNumber()
Returns:
The row in the spreadsheet this represents. This can be handy when mapping a line error from Parser back to the rule row. Will need to have a map of ranges of line numbers that each rule covers. Then can find out the rule that cause it, and this will give the row number to report.


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.