Package org.openntf.domino

Examples of org.openntf.domino.DocumentCollection


  @Override
  public void run() {
    Session session = this.getSession();
    Database db = session.getDatabase("", "CollTest.nsf");
    DocumentCollection coll = db.getAllDocuments();
    //    System.out.println("UNSORTED");
    for (Document doc : coll) {
      //      System.out.println(doc.getItemValueString("MainSortValue") + " " + doc.getLastModifiedDate().getTime());
    }

    List<String> criteria = new ArrayList<String>();
    criteria.add("MainSortValue");
    criteria.add("@modifieddate");
    try {
      DocumentSorter sorter = new DocumentSorter(coll, criteria);
      //      System.out.println("SORTING...");
      long startTime = System.nanoTime();
      DocumentCollection sortedColl = sorter.sort();
      long endTime = System.nanoTime();
      System.out.println("Completed resort in " + ((endTime - startTime) / 1000000) + "ms");
      //      System.out.println("SORTED");
      for (Document doc : sortedColl) {
        System.out.println(doc.getItemValueString("MainSortValue") + " " + doc.getLastModifiedDate().getTime() + " "
View Full Code Here


      //      if (indexDoc.hasItem("DocumentSorter")) {
      //        sorter = indexDoc.getItemValue("DocumentSorter", DocumentSorter.class);
      //        sorter.setDatabase(db);
      //        System.out.println("Starting resort of " + sorter.getCount() + " documents");
      //      } else {
      DocumentCollection coll = db.getAllDocuments();
      sorter = new DocumentSorter(coll, criteria);
      System.out.println("Starting resort of " + coll.getCount() + " documents");
      //      }
      //      System.out.println("SORTING...");

      long startTime = System.nanoTime();
      DocumentCollection sortedColl = sorter.sort();
      long endTime = System.nanoTime();
      System.out.println("Completed resort of " + sortedColl.getCount() + " in " + ((endTime - startTime) / 1000000) + " ms");
      //      int count = 0;
      //      for (Document doc : sortedColl) {
      //        //        System.out.println(doc.getLastModifiedDate().getTime() + " " + doc.getNoteID());
      //        if (++count > 500) {
      //          break;
View Full Code Here

     *            the second reference
     */
    private void iterateAllDocuments(final Database db, final Set<Document> secondReference) {
      System.out.println("Thread " + Thread.currentThread().getName() + " BEGINNING ITERATION of Documents");
      Session s = db.getParent();
      DocumentCollection dc = db.getAllDocuments();
      for (Document doc : dc) {
        docCount++;
        Vector v = doc.getItemValue("$UpdatedBy");
        for (Object o : v) {
          if (o instanceof String) {
View Full Code Here

      Session s = Factory.getSession();
      Database source = s.getDatabase("", SOURCE, true);

      System.out.println("-- START --");
      long start = System.nanoTime();
      DocumentCollection dc = source.getAllDocuments();
      dc.removeAll(true);
      long elapsed = System.nanoTime() - start;
      System.out.println("-- STOP --");

      System.out.println("Thread " + Thread.currentThread().getName() + " elapsed time: " + elapsed / 1000000 + "ms");
View Full Code Here

      }
      System.out.println("ENDING ITERATION of Forms");
      Set<Document> secondReference = new HashSet<Document>();
      Set<Document> thirdReference = new HashSet<Document>();
      System.out.println("Thread " + Thread.currentThread().getName() + " BEGINNING ITERATION of Documents");
      DocumentCollection dc = db.getAllDocuments();
      for (Document doc : dc) {
        docCount++;
        Vector<Object> v = doc.getItemValue("$UpdatedBy");
        for (Object o : v) {
          if (o instanceof String) {
View Full Code Here

      System.out.println("Thread " + Thread.currentThread().getName() + " elapsed time: " + elapsed / 1000000 + "ms");
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void Count(final Database db) {
      DocumentCollection dc = db.getAllDocuments();
      NoteCollection nc = db.createNoteCollection(false);
      nc.add(dc);

      Arrays.asList(nc.getNoteIDs());
      Set setAll = new HashSet(Arrays.asList(nc.getNoteIDs()));
View Full Code Here

    if (last == null)
      last = new Date(0);
    int count = db.getModifiedNoteCount(last);

    if (count > 0) {
      DocumentCollection rawColl = db.getModifiedDocuments(last);
      DocumentSorter sorter = new DocumentSorter(rawColl, MOD_SORT_LIST);
      System.out.println("Scanning database " + db.getApiPath() + " with last date of " + last.getTime() + " and found "
          + rawColl.getCount() + " updates to scan");
      scanner.processSorter(sorter);

    }
    return scanner;
  }
View Full Code Here

   * @see org.openntf.domino.View#getAllDocuments()
   */
  @Override
  public DocumentCollection getAllDocuments() {
    Database db = getAncestorDatabase();
    DocumentCollection result = db.createDocumentCollection();

    // When it's a folder, there's no selection formula, so do it the "dumb" way for now
    if (isFolder()) {
      // TODO See if there's a better way
      for (ViewEntry entry : getAllEntries()) {
        if (entry.isDocument()) {
          result.add(entry.getDocument());
        }
      }
    } else {
      // According to Tommy Valand's research, the fastest method is to build a NoteCollection with a matching selection formula
      // http://dontpanic82.blogspot.com/2013/06/benchmark-fetching-noteids-and.html
      NoteCollection nc = getNoteCollection();

      int[] nids = nc.getNoteIDs();

      // Arrays.sort(nids);
      // for (org.openntf.domino.Document doc : result) {
      // int nid = Integer.valueOf(doc.getNoteID(), 16);
      // if (!(Arrays.binarySearch(nids, nid) >= 0)) {
      // result.subtract(nid);
      // }
      // }

      // for (int nid : nids) {
      // result.intersect(nid);
      // }

      // TODO due to a bug in 9.0, this is being reverted to highly inefficient behavior...
      for (int nid : nids) {
        Document doc = db.getDocumentByID(Integer.toHexString(nid));
        result.add(doc);
      }
    }
    return result;
  }
View Full Code Here

      if (domKey instanceof java.util.Vector) {
        lotusColl = getDelegate().getAllDocumentsByKey((java.util.Vector) domKey, exact);
      } else {
        lotusColl = getDelegate().getAllDocumentsByKey(domKey, exact);
      }
      DocumentCollection dc = fromLotus(lotusColl, DocumentCollection.SCHEMA, getAncestorDatabase());
      if (dc instanceof org.openntf.domino.impl.DocumentCollection) {
        ((org.openntf.domino.impl.DocumentCollection) dc).setParentView(this);
      }
      return dc;
View Full Code Here

   */
  @Override
  public boolean checkUnique(final Object key, final Document srcDoc) {
    boolean retVal_ = false;
    try {
      DocumentCollection dc = this.getAllDocumentsByKey(key, true);
      for (Document checkDoc : dc) {
        if (null == srcDoc) {
          return false;
        } else {
          if (!checkDoc.getUniversalID().equals(srcDoc.getUniversalID())) {
View Full Code Here

TOP

Related Classes of org.openntf.domino.DocumentCollection

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.