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입니다(“디:/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);
}
}


============================================= ============================================== 아마존에서 최고의 Techalpine 책을 구입하십시오,en,전기 기술자 CT 밤나무 전기,en
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share