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) fails. 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:-

importēt java.io.FileInputStream;
Importa java.io.FileNotFoundException;
importēt java.io.InputStream;
Importa org.drools.decisiontable.InputType;
Importa org.drools.decisiontable.SpreadsheetCompiler;

public class ExcelToDrlDemo {
valsts statisko spēku galvenās(String args[]) {
// create an input stream
InputStream ir = null;
izmēģināt {
// 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
ir = jauns FileInputStream(“D:/Workspace/TestProj/src/ExamplePolicyPricing.xls”);
} noķert (FileNotFoundException e) {
e.printStackTrace();
}
// create compiler class instance
SpreadsheetCompiler sc = jauns SpreadsheetCompiler();
// compile the excel to generate the (.DRL) fails
String drl=sc.compile(ir, InputType.XLS);
// check the generated (.DRL) fails
Println(“Generate DRL file is –: “);
Println(DRL);
}
}


============================================= ============================================== Pērciet labākās Techalpine grāmatas vietnē Amazon,en,Elektriķa CT kastaņu valodas,en
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share