How to convert Drools decision table (excel spread sheet) to a (.DRL) file in Drools?

Let us try to create convert Drools decision table (excel spread sheet) to a (.DRL) file in Drools.
The SpreadsheetCompiler class is used to convert the input XLS and CSV file to a (.DRL) ファイル. The required package is “org.drools.decisiontable.SpreadsheetCompiler”.You need to use the compile () method of this class to do the conversion. Following example shows the processs.



Example program:-

輸入java.io.FileInputStream;
輸入java.io.FileNotFoundExceptionが;
java.io.InputStreamをインポート;
輸入org.drools.decisiontable.InputType;
輸入org.drools.decisiontable.SpreadsheetCompiler;

public class ExcelToDrlDemo {
公共の静的な無効メイン(String args[]) {
// create an input stream
InputStreamは、= NULLである;
試す {
// assign the excel to the input stream
// mention the local directory path where your excel is kept
// you can take any decision table (excel sheet) for testing
=新しいFileInputStreamはある(“D:/Workspace/TestProj/src/ExamplePolicyPricing.xls”);
} キャッチ (FileNotFoundExceptionが電子) {
e.printStackTrace();
}
// create compiler class instance
SpreadsheetCompilerのSC =新しいSpreadsheetCompilerの();
// compile the excel to generate the (.DRL) ファイル
String drl=sc.compile(です, InputType.XLS);
// check the generated (.DRL) ファイル
System.out.printlnは(“Generate DRL file is –: “);
System.out.printlnは(DRL);
}
}


============================================= ============================================== Amazonで最高のTechAlpine Booksを購入してください,en,電気技師CT栗,en
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share