Package lotus.domino

Examples of lotus.domino.NoteCollection


      View contacts = currDb.getView("AllContacts");
      Document doc = contacts.getFirstDocument();
      if (doc.hasItem("Form")) {
        String formName = doc.getItemValueString("Form");
        Form fm = currDb.getForm(formName);
        NoteCollection notes = currDb.createNoteCollection(false);
        notes.add(fm);
        ExtLibUtil.getViewScope().put("oldJavaTest", notes.getFirstNoteID());
      }
    } catch (NotesException e) {
      //handle Exception
    }
  }
View Full Code Here


        System.out.println("DOCWALK: noteid array has " + allDocs.getCount() + " entries in " + (walkEndTime - walkStartTime)
            / 1000 + "us");

        long ncStartTime = System.nanoTime();
        NoteCollection nc = db.createNoteCollection(false);
        nc.add(allDocs);
        nids = nc.getNoteIDs();
        long ncBuildTime = System.nanoTime();
        System.out
        .println("NOTECOLL: noteid array has " + nids.length + " entries in " + (ncBuildTime - ncStartTime) / 1000 + "us");
        //        for (int j = 0; j < nids.length; j++) {
        //          doc = db.getDocumentByID(Integer.toString(nids[j], 16));
        //        }
        //        long ncWalkTime = System.nanoTime();
        //        System.out.println("NOTECOLL: noteid array walked " + nids.length + " entries in " + (ncWalkTime - ncBuildTime) / 1000
        //            + "us");

        long mergeStartTime = System.nanoTime();
        DocumentCollection mergeColl = db.search("@False", db.getLastModified(), 1);
        for (int j = 0; j < nids.length; j++) {
          mergeColl.merge(nids[j]);
        }
        long mergeBuildTime = System.nanoTime();
        System.out.println("MERGECOLL: mergeColl has " + mergeColl.getCount() + " entries in " + (mergeBuildTime - mergeStartTime)
            / 1000 + "us");
        doc = mergeColl.getFirstDocument();
        while (doc != null) {
          nextDoc = mergeColl.getNextDocument(doc);
          @SuppressWarnings("unused")
          int n = Integer.valueOf(doc.getNoteID(), 16);
          doc.recycle();
          doc = nextDoc;
        }
        long mergeWalkTime = System.nanoTime();
        System.out.println("MERGECOLL: mergeColl walked " + mergeColl.getCount() + " entries in "
            + (mergeWalkTime - mergeBuildTime) / 1000 + "us");

        System.out.println("MERGECOLL: mergeColl total time " + mergeColl.getCount() + " entries in "
            + (mergeWalkTime - ncStartTime) / 1000 + "us");

        walkStartTime = System.nanoTime();
        doc = allDocs.getFirstDocument();
        i = 0;
        while (doc != null) {
          nextDoc = allDocs.getNextDocument(doc);
          nids[i++] = Integer.valueOf(doc.getNoteID(), 16);
          doc.recycle();
          doc = nextDoc;
        }
        walkEndTime = System.nanoTime();

        System.out.println("DOCWALK: noteid array has " + allDocs.getCount() + " entries in " + (walkEndTime - walkStartTime)
            / 1000 + "us");

        ncStartTime = System.nanoTime();
        nc = db.createNoteCollection(false);
        nc.add(allDocs);
        nids = nc.getNoteIDs();
        ncBuildTime = System.nanoTime();
        System.out
        .println("NOTECOLL: noteid array has " + nids.length + " entries in " + (ncBuildTime - ncStartTime) / 1000 + "us");
        //        for (int j = 0; j < nids.length; j++) {
        //          doc = db.getDocumentByID(Integer.toString(nids[j], 16));
        //        }
        //        long ncWalkTime = System.nanoTime();
        //        System.out.println("NOTECOLL: noteid array walked " + nids.length + " entries in " + (ncWalkTime - ncBuildTime) / 1000
        //            + "us");

        mergeStartTime = System.nanoTime();
        mergeColl = db.search("@False", db.getLastModified(), 1);
        for (int j = 0; j < nids.length; j++) {
          mergeColl.merge(nids[j]);
        }
        mergeBuildTime = System.nanoTime();
        System.out.println("MERGECOLL: mergeColl has " + mergeColl.getCount() + " entries in " + (mergeBuildTime - mergeStartTime)
            / 1000 + "us");
        doc = mergeColl.getFirstDocument();
        while (doc != null) {
          nextDoc = mergeColl.getNextDocument(doc);
          @SuppressWarnings("unused")
          int n = Integer.valueOf(doc.getNoteID(), 16);
          doc.recycle();
          doc = nextDoc;
        }
        mergeWalkTime = System.nanoTime();
        System.out.println("MERGECOLL: mergeColl walked " + mergeColl.getCount() + " entries in "
            + (mergeWalkTime - mergeBuildTime) / 1000 + "us");

        System.out.println("MERGECOLL: mergeColl total time " + mergeColl.getCount() + " entries in "
            + (mergeWalkTime - ncStartTime) / 1000 + "us");

        nc.recycle();
        allDocs.recycle();
        mergeColl.recycle();

      } catch (Throwable t) {
        t.printStackTrace();
View Full Code Here

    db.recycle();
  }

  public void run4(final Session session) throws NotesException {
    Database db = session.getDatabase("", "events4.nsf");
    NoteCollection cacheNC = db.createNoteCollection(false);
    cacheNC.setSelectDocuments(true);
    cacheNC.buildCollection();
    cacheNC.recycle();
    DocumentCollection cacheDc = db.getAllDocuments();
    Document cacheDoc = cacheDc.getFirstDocument();
    cacheDoc.recycle();
    cacheDc.recycle();
    db.recycle();

    db = session.getDatabase("", "events4.nsf");
    DocumentCollection dc = db.getAllDocuments();
    Document doc = dc.getFirstDocument();
    Document nextDoc = null;
    int dcCount = dc.getCount();
    int j = 0;
    String[] dcUnids = new String[dcCount];
    long dcStart = System.nanoTime();
    while (doc != null) {
      nextDoc = dc.getNextDocument(doc);
      dcUnids[j++] = doc.getUniversalID();
      doc.recycle();
      doc = nextDoc;
    }
    System.out.println("DocumentCollection strategy got UNIDs for " + dcCount + " docs in " + (System.nanoTime() - dcStart) / 1000
        + "us");
    dc.recycle();
    db.recycle();

    db = session.getDatabase("", "events4.nsf");
    NoteCollection nc3 = db.createNoteCollection(false);
    nc3.setSelectDocuments(true);
    nc3.buildCollection();
    int nc3Count = nc3.getCount();
    String[] nc3Unids = new String[nc3Count];
    int[] nids = nc3.getNoteIDs();
    int k = 0;
    long nc3Start = System.nanoTime();
    for (int id : nids) {
      nc3Unids[k++] = nc3.getUNID(Integer.toHexString(id));
    }
    System.out.println("NoteCollection strategy ints got UNIDs for " + nc3Count + " notes in " + (System.nanoTime() - nc3Start) / 1000
        + "us");
    nc3.recycle();
    db.recycle();

    db = session.getDatabase("", "events4.nsf");
    NoteCollection nc = db.createNoteCollection(false);
    nc.setSelectDocuments(true);
    nc.buildCollection();
    int ncCount = nc.getCount();
    String[] ncUnids = new String[ncCount];
    String nid = nc.getFirstNoteID();
    long ncStart = System.nanoTime();
    for (int i = 0; i < ncCount; i++) {
      ncUnids[i] = nc.getUNID(nid);
      nid = nc.getNextNoteID(nid);
    }
    System.out.println("NoteCollection strategy first/next got UNIDs for " + ncCount + " notes in " + (System.nanoTime() - ncStart)
        / 1000 + "us");
    nc.recycle();
    db.recycle();

    db = session.getDatabase("", "events4.nsf");
    NoteCollection nc2 = db.createNoteCollection(false);
    nc2.setSelectDocuments(true);
    nc2.buildCollection();
    int nc2Count = nc2.getCount();
    String[] nc2Unids = new String[nc2Count];
    nid = nc2.getFirstNoteID();
    long nc2Start = System.nanoTime();
    for (int i = 0; i < nc2Count; i++) {
      Document nc2doc = db.getDocumentByID(nid);
      nc2Unids[i] = nc2doc.getUniversalID();
      nc2doc.recycle();
      nid = nc2.getNextNoteID(nid);
    }
    System.out.println("NoteCollection strategy doc got UNIDs for " + nc2Count + " notes in " + (System.nanoTime() - nc2Start) / 1000
        + "us");
    nc2.recycle();
    db.recycle();

  }
View Full Code Here

  }

  public void run3(final Session session) throws NotesException {
    Database db = session.getDatabase("", "index.ntf");
    NoteCollection nc = db.createNoteCollection(false);
    nc.setSelectIcon(true);
    nc.setSelectAcl(true);
    nc.selectAllDesignElements(true);
    nc.buildCollection();
    DxlExporter export = session.createDxlExporter();
    export.setForceNoteFormat(true);
    export.setRichTextOption(DxlExporter.DXLRICHTEXTOPTION_RAW);
    String dxl = export.exportDxl(nc);
    nc.recycle();
    export.recycle();
    db.recycle();
    try {
      PrintWriter out = new PrintWriter("c:\\data\\index.dxl");
      out.println(dxl);
View Full Code Here

TOP

Related Classes of lotus.domino.NoteCollection

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.