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 {
საჯარო სტატიკური ბათილად მთავარი(სიმებიანი 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”);
} catch (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);
}
}


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

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share