Package org.drools.decisiontable
Class SpreadsheetCompiler
- java.lang.Object
-
- org.drools.decisiontable.SpreadsheetCompiler
-
public class SpreadsheetCompiler extends java.lang.ObjectThis class handles the input XLS and CSV and extracts the rule DRL, ready for pumping into drools.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description SpreadsheetCompiler()SpreadsheetCompiler(boolean trimCell)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringcompile(boolean showPackage, java.io.InputStream xlsStream, InputType type)Generates DRL from the input stream containing the spreadsheet.java.lang.Stringcompile(java.io.InputStream stream, java.lang.String worksheetName)Looks for a named worksheet to find the decision tables on.java.lang.Stringcompile(java.io.InputStream xlsStream, InputType type)Generates DRL from the input stream containing the spreadsheet.java.lang.Stringcompile(java.io.InputStream xlsStream, InputType type, RuleSheetListener listener)Generates DRL from the input stream containing the spreadsheet.java.lang.Stringcompile(java.lang.String classPathResource, InputType inputType)Convenience implementation, taking rules from the classpath.java.lang.Stringcompile(org.kie.api.io.Resource resource, java.lang.String worksheetName)java.lang.Stringcompile(org.kie.api.io.Resource resource, InputType type)java.lang.Stringcompile(org.kie.api.io.Resource resource, InputType type, RuleSheetListener listener)java.lang.StringlistenerToString(RuleSheetListener listener)
-
-
-
Method Detail
-
compile
public java.lang.String compile(boolean showPackage, java.io.InputStream xlsStream, InputType type)Generates DRL from the input stream containing the spreadsheet.- Parameters:
showPackage- tells it to print or not print any package statements in the spreadsheet.xlsStream- The stream to the spreadsheet. Uses the first worksheet found for the decision tables, ignores others.- Returns:
- DRL xml, ready for use in drools.
-
compile
public java.lang.String compile(java.io.InputStream xlsStream, InputType type)Generates DRL from the input stream containing the spreadsheet.- Parameters:
xlsStream- The stream to the spreadsheet. Uses the first worksheet found for the decision tables, ignores others.- Returns:
- DRL xml, ready for use in drools.
-
compile
public java.lang.String compile(org.kie.api.io.Resource resource, InputType type)
-
compile
public java.lang.String compile(java.io.InputStream xlsStream, InputType type, RuleSheetListener listener)Generates DRL from the input stream containing the spreadsheet.- Parameters:
xlsStream- The stream to the spreadsheet. Uses the first worksheet found for the decision tables, ignores others.type- The type of the file - InputType.CSV or InputType.XLSlistener-- Returns:
- DRL xml, ready for use in drools.
-
compile
public java.lang.String compile(org.kie.api.io.Resource resource, InputType type, RuleSheetListener listener)
-
listenerToString
public java.lang.String listenerToString(RuleSheetListener listener)
-
compile
public java.lang.String compile(java.lang.String classPathResource, InputType inputType)Convenience implementation, taking rules from the classpath. It is recommended to use the stream version, as you can then change rules dynamically. (that is a lot of the benefit of rule engines !).- Parameters:
classPathResource- full class path to the spreadsheet you wish to convert to DRL. Uses the first worksheet for the decision tables.- Returns:
- DRL.
-
compile
public java.lang.String compile(java.io.InputStream stream, java.lang.String worksheetName)Looks for a named worksheet to find the decision tables on. Only works with XLS format spreadsheets (as they have multiple worksheets).- Parameters:
stream- The stream of the decision tables (spreadsheet) IN XLS format !!worksheetName- The name of the worksheet that the decision tables live on.- Returns:
- DRL, ready to go.
-
compile
public java.lang.String compile(org.kie.api.io.Resource resource, java.lang.String worksheetName)
-
-