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

Let us try to create convert Drools decision table (excel spread sheet) to a (.дрл) file in Drools.
The SpreadsheetCompiler class is used to convert the input XLS and CSV file to a (.дрл) фајл. 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:-

увоз јава.ио.ФилеИнпутСтреам;
увоз јава.ио.ФилеНотФоундЕкцептион;
увоз јава.ио.ИнпутСтреам;
увоз орг.дроолс.децисионтабле.ИнпутТипе;
увоз орг.дроолс.децисионтабле.СпреадсхеетЦомпилер;

public class ExcelToDrlDemo {
публиц статиц воид маин(String args[]) {
// create an input stream
ИнпутСтреам је = нулл;
пробати {
// 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
је = нови ФилеИнпутСтреам(“Д:/Workspace/TestProj/src/ExamplePolicyPricing.xls”);
} улов (ФилеНотФоундЕкцептион е) {
е.принтСтацкТраце();
}
// create compiler class instance
СпреадсхеетЦомпилер сц = нев СпреадсхеетЦомпилер();
// compile the excel to generate the (.дрл) фајл
String drl=sc.compile(је, ИнпутТипе.КСЛС);
// check the generated (.дрл) фајл
Систем.оут.принтлн(“Generate DRL file is –: “);
Систем.оут.принтлн(дрл);
}
}


============================================= ============================================== Buy best TechAlpine Books on Amazon
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share