0 Replies Latest reply on Jun 9, 2011 6:33 AM by leon_

    Converting xls to drl in jBPM 5.1

    leon_ Newbie

      I keep receiving error messages when trying to use a decision table as DRL file instead of separate business rules. Things seem to go wrong during the conversion of the XLS file to DRL. I have attached the XLS file and will copy the relevant code of my ProcessTestJava file.

       

      import org.drools.RuleBase;

      import org.drools.RuleBaseFactory;

      import org.drools.builder.ResourceType;

      import org.drools.compiler.PackageBuilder;

      import org.drools.decisiontable.InputType;

      import org.drools.decisiontable.SpreadsheetCompiler;

      import org.drools.rule.Package;    

       

      private static RuleBase readDecisionTable() throws Exception {            

       

           //read in the source        

           final SpreadsheetCompiler converter = new SpreadsheetCompiler();        

           final String drl = converter.compile( "D:/jbpm-installer/workspace/rechtwijzer/src/main/RegelsRechtwijzerDT.xls", InputType.XLS );        

           System.out.println(drl);         

           PackageBuilder builder = new PackageBuilder();         

           builder.addPackageFromDrl( new StringReader( drl ) );        

           Package pkg = builder.getPackage();        

           RuleBase ruleBase = RuleBaseFactory.newRuleBase();         

           ruleBase.addPackage( pkg );         

           return ruleBase;     

      }