/** * @param rulename * @param support 0: no 1: yes 2: all * @return */ public LinkedList<String> getPCREbyRuleset(Workbook book, String rulename, int support) { LinkedList<String> lpcre = new LinkedList<String>(); Sheet sheet = book.getSheet(rulename); if (sheet == null) { return null; } // begin to read int index = 1; while (index < sheet.getRows()) { String pStatus = sheet.getCell(3, index).getContents(); String pcre = sheet.getCell(4, index).getContents(); if (support == 1) { if (pStatus.compareToIgnoreCase("1") == 0) { lpcre.add(pcre); } } else if (support == 0) { if (pStatus.compareToIgnoreCase("0") == 0) { lpcre.add(pcre); } } else { lpcre.add(pcre); } index++; } return lpcre; }
Parser_16_05_2011(String file) { try { this.workbook = Workbook.getWorkbook(new File(config.excelfile)); } catch (IOException ex) { Logger.getLogger(Parser_16_05_2011.class.getName()).log(Level.SEVERE, null, ex); } catch (BiffException ex) { Logger.getLogger(Parser_16_05_2011.class.getName()).log(Level.SEVERE, null, ex); } }
private void Action() throws IOException, WriteException, BiffException { workbook = Workbook.getWorkbook(new File(config.excelfile)); // LinkedList<String> lpcre = this.getPCREbyRuleset(workbook, rule, 1); switch (config.actions) { case 0: this.Extract(); break; case 1: this.ExtractByRules(); break; default: } }