Package net.firstpartners.drools.log

Examples of net.firstpartners.drools.log.SpreadSheetLogger


   */
  public HSSFWorkbook callRules(InputStream inputFromExcel, RuleSource ruleSource,
      String nameOfLogSheet) throws DroolsParserException, IOException, ClassNotFoundException {

    // Create a new Excel Logging object
    SpreadSheetLogger spreadsheetLogger = new SpreadSheetLogger();

    // Convert this into a (POI) Workbook
    HSSFWorkbook wb = new HSSFWorkbook(new POIFSFileSystem(inputFromExcel));

    // Convert the cell
    RangeHolder ranges = RangeConvertor.convertExcelToCells(wb);

    //Call the overloaded method to actually run the rules
    callRules(ranges,ruleSource,nameOfLogSheet,spreadsheetLogger);

    // update the excel spreadsheet with the result of our rules
    RangeConvertor.convertCellsToExcel(wb, ranges);

    // update the excel spreadsheet with our log file
    spreadsheetLogger.flush(wb, nameOfLogSheet);

    // Close our input work book
    inputFromExcel.close();

    // Return the workbook
View Full Code Here


    // Convert the cell
    RangeHolder ranges = RangeConvertor.convertExcelToCells(wb);
    HashMap<String, Object> globals = new HashMap<String, Object>();

    // Create a new Excel Logging object
    SpreadSheetLogger excelLogger = new SpreadSheetLogger();

    // Log the cell contents
    log.debug("============ Excel Cell Contents In =========");
    for (Range r : ranges) {
      log.debug(r);
    }

    // Set Paramaters
    RuleSource ruleSource = new RuleSource();
    ruleSource.setDslFileLocation(DSL_FILE);
    ruleSource.setRulesLocation(RULES_FILES);
    ruleSource.setFacts(ranges.getAllRangesAndCells());
    ruleSource.setGlobals(globals);

    // Load and fire our rules files against the data
    new RuleRunner(new FileRuleLoader()).runStatelessRules(ruleSource,excelLogger);

    // Log the cell contents
    log.debug("============ Excel Cell Contents Out =========");
    for (Range r : ranges) {
      log.debug(r);
    }

    // update the excel spreadsheet with the result of our rules
    RangeConvertor.convertCellsToExcel(wb, ranges);

    // update the excel spreadsheet with our log file
    excelLogger.flush(wb, EXCEL_LOG_WORKSHEET_NAME);

    // Write out modified Excel sheet
    SpreadSheetOutputter.outputToFile(wb, EXCEL_OUTPUT_FILE);

    // Close our input work book
View Full Code Here

    // Convert the cell
    RangeHolder ranges = RangeConvertor.convertExcelToCells(wb);
    HashMap<String, Object> globals = new HashMap<String, Object>();

    // Create a new Excel Logging object
    SpreadSheetLogger excelLogger = new SpreadSheetLogger();

    // Set Paramaters
    RuleSource ruleSource = new RuleSource();
    ruleSource.setRulesLocation(RULES_FILES);
    ruleSource.setFacts(ranges.getAllRangesAndCells());
    ruleSource.setGlobals(globals);


    // Load and fire our rules files against the data
    new RuleRunner(new FileRuleLoader()).runStatelessRules(ruleSource,excelLogger);


    // update the excel spreadsheet with the result of our rules
    RangeConvertor.convertCellsToExcel(wb, ranges);

    // update the excel spreadsheet with our log file
    excelLogger.flush(wb, EXCEL_LOG_WORKSHEET_NAME);

    // Write out modified Excel sheet
    SpreadSheetOutputter.outputToFile(wb, EXCEL_OUTPUT_FILE);

    // Close our input work book
View Full Code Here

    // Convert the cell
    RangeHolder ranges = RangeConvertor.convertExcelToCells(wb);
    HashMap<String, Object> globals = new HashMap<String, Object>();

    // Create a new Excel Logging object
    SpreadSheetLogger excelLogger = new SpreadSheetLogger();

    // Log the cell contents
    log.debug("============ Excel Cell Contents In =========");
    for (Range r : ranges) {
      log.debug(r);
    }

    //Setup our parameters
    RuleSource ruleSource = new RuleSource();
    ruleSource.setRulesLocation(RULES_FILES);
    ruleSource.setFacts(ranges.getAllRangesAndCells());
    ruleSource.setGlobals(globals);

    // Load and fire our rules files against the data
    new RuleRunner(new FileRuleLoader()).runStatelessRules(ruleSource,excelLogger);

    // Log the cell contents
    log.debug("============ Excel Cell Contents Out =========");
    for (Range r : ranges) {
      log.debug(r);
    }

    // update the excel spreadsheet with the result of our rules
    RangeConvertor.convertCellsToExcel(wb, ranges);

    // update the excel spreadsheet with our log file
    excelLogger.flush(wb, EXCEL_LOG_WORKSHEET_NAME);

    // Write out modified Excel sheet
    SpreadSheetOutputter.outputToFile(wb, EXCEL_OUTPUT_FILE);

    // Close our input work book
View Full Code Here

TOP

Related Classes of net.firstpartners.drools.log.SpreadSheetLogger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.