示例#1
0
  private List<Item> getDocuments() throws Exception {
    List<Item> items = new ArrayList<Item>();
    LuceneSearcher searcher = new LuceneSearcher(this.caseFacade.getCase());

    for (Integer id : this.resultId) {
      Document currentDocument = searcher.getLuceneDocumentById(String.valueOf(id));
      Item fileItem = ItemFactory.newInstance(currentDocument, this.caseFacade, false);
      items.add(fileItem);
    }

    searcher.closeSearcher();
    return items;
  }
示例#2
0
  private void getAllMessageInEmailSource(final String value, final String constant) {
    IndexReader indexReader = null;

    try {
      List<Integer> ids = new ArrayList<Integer>();

      Directory dir =
          FSDirectory.open(new File(this.panel.getCaseFacade().getCaseIndexFolderLocation()));
      indexReader = IndexReader.open(dir);
      Map<Entry, Integer> messageCounter = new HashMap<Entry, Integer>();

      for (int i = 0; i < indexReader.maxDoc(); i++) {
        if (this.isCancelledTask()) {
          break;
        }

        Document document = indexReader.document(i);

        if (document != null) {
          Field field = document.getField(constant);
          if (field != null && field.stringValue() != null) {
            String tmp = field.stringValue();

            if (tmp.endsWith(value)) {
              EmailItem item =
                  (EmailItem) ItemFactory.newInstance(document, panel.getCaseFacade(), false);

              String to = "";
              if (item.getTo() == null || item.getTo().trim().isEmpty()) to = value;
              else to = item.getTo();

              if (checkingItemType(item)) {
                Entry entry = new Entry(item.getFrom(), to, item.getTime());

                Integer indexNo = messageCounter.get(entry);

                if (indexNo == null) {
                  messageCounter.put(entry, 1);
                } else {
                  messageCounter.put(entry, indexNo + 1);
                }

                ids.add(Integer.valueOf(item.getDocumentId()));
              }
            }
          }
        }
      }

      if (this.type == EMAIL_PROCESSING_TYPE.INBOX || this.type == EMAIL_PROCESSING_TYPE.SEND_ITEM)
        addResultToTable(messageCounter);
      else addDateResultToTable(messageCounter);

      messageCounter.clear();
      messageCounter = null;
    } catch (IOException ex) {
      ex.printStackTrace();
      Logger.getLogger(EmailProcessingTask.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
      try {
        indexReader.close();
      } catch (IOException ex) {
        Logger.getLogger(EmailProcessingTask.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
  }