org.drools.decisiontable
Class SpreadsheetDRLConverter

java.lang.Object
  extended by org.drools.decisiontable.SpreadsheetDRLConverter

public class SpreadsheetDRLConverter
extends java.lang.Object


Constructor Summary
SpreadsheetDRLConverter()
           
 
Method Summary
 java.lang.String convertToDRL(java.io.InputStream xlsStream, InputType type)
          Generates DRL from the input stream containing the spreadsheet.
 java.lang.String convertToDRL(java.io.InputStream stream, java.lang.String worksheetName)
          Looks for a named worksheet to find the decision tables on.
 java.lang.String convertToDRL(java.lang.String classPathResource, InputType inputType)
          Convenience implementation, taking rules from the classpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpreadsheetDRLConverter

public SpreadsheetDRLConverter()
Method Detail

convertToDRL

public java.lang.String convertToDRL(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.

convertToDRL

public java.lang.String convertToDRL(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.

convertToDRL

public java.lang.String convertToDRL(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.