private void logDecisionTableAsDrools(String decisionTableResourceName) {
   InputStream input =
       Thread.currentThread()
           .getContextClassLoader()
           .getResourceAsStream("rules/" + decisionTableResourceName);
   SpreadsheetCompiler sc = new SpreadsheetCompiler();
   StringBuffer drl = new StringBuffer(sc.compile(input, InputType.XLS));
   System.out.println(drl.toString());
 }
Esempio n. 2
0
  private static void leerReglasXLS() {
    /*XLS*/
    InputStream is = null;
    try {
      is =
          new FileInputStream(
              "C:\\temporal\\god\\god-drools\\src\\main\\java\\com\\rest\\services\\god\\drools\\rule\\rule.xls");
      SpreadsheetCompiler sc = new SpreadsheetCompiler();
      StringBuffer drl2 = new StringBuffer(sc.compile(is, InputType.XLS));
      System.out.println(drl2);
      BufferedWriter out =
          new BufferedWriter(
              new FileWriter(
                  "C:\\temporal\\god\\god-drools\\src\\main\\java\\com\\rest\\services\\god\\drools\\rule\\testRule.drl"));
      out.write(drl2.toString().replace("“", "\"").replace("”", "\""));
      out.close();

    } catch (IOException e) {
      e.printStackTrace();
    }
    /*XLS*/
  }