Package lotus.domino

Examples of lotus.domino.DocumentCollection


  }

  public void exportDocuments(Database database) throws IOException, NotesException {
    target.startExport();
    try {
      DocumentCollection docs = database.getAllDocuments();
      try {
        for(Document doc=docs.getFirstDocument(); doc!=null; doc=docs.getNextDocument(doc)) {
          exportDocument(doc);
        }
      } finally {
        docs.recycle();
      }
    } finally {
      target.endExport();
    }
  }
View Full Code Here


     
      // Getting the specified Notes database.
      Database database = session.getDatabase( "", stringDatabase );
     
      // Getting a collection of all documents from the database.
      DocumentCollection documentcollection = database.getAllDocuments();
     
      // Getting the first document from the database
      Document document = documentcollection.getFirstDocument();
     
      // Start to write to cells at this row.
      int intRowToStart = 0;
     
      // The current row.
      int intRow = intRowToStart;
     
      // The current column.
      int intColumn = 0;
     
      // Process all documents
      while ( document != null ) {
        // Getting the name of the stock.
        String stringName = document.getItemValueString( "Name" );
       
        // Inserting the name to a specified cell.
        insertIntoCell( intColumn, intRow, stringName, xspreadsheet, "" );
       
        // Getting the number of stocks.
        double intNumber = document.getItemValueInteger( "Number" );
       
        // Inserting the number of stocks to a specified cell.
        insertIntoCell( intColumn + 1, intRow, String.valueOf( intNumber ),
        xspreadsheet, "V" );
       
        // Getting current share price.
        double doubleSharePrice = document.getItemValueDouble( "SharePrice" );
       
        // Inserting the current share price to a specified cell.
        insertIntoCell( intColumn + 2, intRow, String.valueOf( doubleSharePrice ),
        xspreadsheet, "V" );
       
        // Inserting the total value.
        insertIntoCell( intColumn + 3, intRow, "=B"
        + String.valueOf( intRow + 1 ) + "*C" + String.valueOf( intRow + 1 ),
        xspreadsheet, "" );
       
        // Increasing the current row.
        intRow++;
       
        // Getting the next document from the collection.
        document = documentcollection.getNextDocument();
      }
     
      // Summing all specific amounts.
      insertIntoCell( intColumn + 3, intRow, "=sum(D"
      + String.valueOf( intRowToStart + 1 ) + ":D"
View Full Code Here

     
            // Getting the specified Notes database.
            Database database = session.getDatabase( "", stringDatabase );
           
            // Getting a collection of all documents from the database.
            DocumentCollection documentCollection = database.getAllDocuments();
     
            // Getting the first document from the database
            Document document = documentCollection.getFirstDocument();
     
            // Start to write to cells at this row.
            int intRowToStart = 0;
     
            // The current row.
            int intRow = intRowToStart;
     
            // The current column.
            int intColumn = 0;
     
            // Process all documents
            while ( document != null ) {
                // Getting the name of the stock.
                String stringName = document.getItemValueString("Name");
               
                // Inserting the name to a specified cell.
                insertIntoCell(intColumn, intRow, stringName, xSpreadsheet, "");
               
                // Getting the number of stocks.
                double intNumber = document.getItemValueInteger( "Number" );
       
                // Inserting the number of stocks to a specified cell.
                insertIntoCell( intColumn + 1, intRow, String.valueOf(intNumber),
                                xSpreadsheet, "V" );
       
                // Getting current share price.
                double doubleSharePrice = document.getItemValueDouble("SharePrice");
       
                // Inserting the current share price to a specified cell.
                insertIntoCell(intColumn + 2, intRow,
                               String.valueOf(doubleSharePrice),
                               xSpreadsheet, "V");
       
                // Inserting the total value.
                insertIntoCell(intColumn + 3, intRow, "=B"
                               + String.valueOf( intRow + 1 )
                               + "*C" + String.valueOf(intRow + 1),
                               xSpreadsheet, "");
       
                // Increasing the current row.
                intRow++;
               
                // Getting the next document from the collection.
                document = documentCollection.getNextDocument();
            }
     
            // Summing all specific amounts.
            insertIntoCell(intColumn + 3, intRow, "=sum(D"
                           + String.valueOf( intRowToStart + 1 ) + ":D"
View Full Code Here

     
            // Getting the specified Notes database.
            Database database = session.getDatabase( "", stringDatabase );
           
            // Getting a collection of all documents from the database.
            DocumentCollection documentCollection = database.getAllDocuments();
     
            // Getting the first document from the database
            Document document = documentCollection.getFirstDocument();
     
            // Start to write to cells at this row.
            int intRowToStart = 0;
     
            // The current row.
            int intRow = intRowToStart;
     
            // The current column.
            int intColumn = 0;
     
            // Process all documents
            while ( document != null ) {
                // Getting the name of the stock.
                String stringName = document.getItemValueString("Name");
               
                // Inserting the name to a specified cell.
                insertIntoCell(intColumn, intRow, stringName, xSpreadsheet, "");
               
                // Getting the number of stocks.
                double intNumber = document.getItemValueInteger( "Number" );
       
                // Inserting the number of stocks to a specified cell.
                insertIntoCell( intColumn + 1, intRow, String.valueOf(intNumber),
                                xSpreadsheet, "V" );
       
                // Getting current share price.
                double doubleSharePrice = document.getItemValueDouble("SharePrice");
       
                // Inserting the current share price to a specified cell.
                insertIntoCell(intColumn + 2, intRow,
                               String.valueOf(doubleSharePrice),
                               xSpreadsheet, "V");
       
                // Inserting the total value.
                insertIntoCell(intColumn + 3, intRow, "=B"
                               + String.valueOf( intRow + 1 )
                               + "*C" + String.valueOf(intRow + 1),
                               xSpreadsheet, "");
       
                // Increasing the current row.
                intRow++;
               
                // Getting the next document from the collection.
                document = documentCollection.getNextDocument();
            }
     
            // Summing all specific amounts.
            insertIntoCell(intColumn + 3, intRow, "=sum(D"
                           + String.valueOf( intRowToStart + 1 ) + ":D"
View Full Code Here

     
      // Getting the specified Notes database.
      Database database = session.getDatabase( "", stringDatabase );
     
      // Getting a collection of all documents from the database.
      DocumentCollection documentcollection = database.getAllDocuments();
     
      // Getting the first document from the database
      Document document = documentcollection.getFirstDocument();
     
      // Start to write to cells at this row.
      int intRowToStart = 0;
     
      // The current row.
      int intRow = intRowToStart;
     
      // The current column.
      int intColumn = 0;
     
      // Process all documents
      while ( document != null ) {
        // Getting the name of the stock.
        String stringName = document.getItemValueString( "Name" );
       
        // Inserting the name to a specified cell.
        insertIntoCell( intColumn, intRow, stringName, xspreadsheet, "" );
       
        // Getting the number of stocks.
        double intNumber = document.getItemValueInteger( "Number" );
       
        // Inserting the number of stocks to a specified cell.
        insertIntoCell( intColumn + 1, intRow, String.valueOf( intNumber ),
        xspreadsheet, "V" );
       
        // Getting current share price.
        double doubleSharePrice = document.getItemValueDouble( "SharePrice" );
       
        // Inserting the current share price to a specified cell.
        insertIntoCell( intColumn + 2, intRow, String.valueOf( doubleSharePrice ),
        xspreadsheet, "V" );
       
        // Inserting the total value.
        insertIntoCell( intColumn + 3, intRow, "=B"
        + String.valueOf( intRow + 1 ) + "*C" + String.valueOf( intRow + 1 ),
        xspreadsheet, "" );
       
        // Increasing the current row.
        intRow++;
       
        // Getting the next document from the collection.
        document = documentcollection.getNextDocument();
      }
     
      // Summing all specific amounts.
      insertIntoCell( intColumn + 3, intRow, "=sum(D"
      + String.valueOf( intRowToStart + 1 ) + ":D"
View Full Code Here

     
            // Getting the specified Notes database.
            Database database = session.getDatabase( "", stringDatabase );
           
            // Getting a collection of all documents from the database.
            DocumentCollection documentCollection = database.getAllDocuments();
     
            // Getting the first document from the database
            Document document = documentCollection.getFirstDocument();
     
            // Start to write to cells at this row.
            int intRowToStart = 0;
     
            // The current row.
            int intRow = intRowToStart;
     
            // The current column.
            int intColumn = 0;
     
            // Process all documents
            while ( document != null ) {
                // Getting the name of the stock.
                String stringName = document.getItemValueString("Name");
               
                // Inserting the name to a specified cell.
                insertIntoCell(intColumn, intRow, stringName, xSpreadsheet, "");
               
                // Getting the number of stocks.
                double intNumber = document.getItemValueInteger( "Number" );
       
                // Inserting the number of stocks to a specified cell.
                insertIntoCell( intColumn + 1, intRow, String.valueOf(intNumber),
                                xSpreadsheet, "V" );
       
                // Getting current share price.
                double doubleSharePrice = document.getItemValueDouble("SharePrice");
       
                // Inserting the current share price to a specified cell.
                insertIntoCell(intColumn + 2, intRow,
                               String.valueOf(doubleSharePrice),
                               xSpreadsheet, "V");
       
                // Inserting the total value.
                insertIntoCell(intColumn + 3, intRow, "=B"
                               + String.valueOf( intRow + 1 )
                               + "*C" + String.valueOf(intRow + 1),
                               xSpreadsheet, "");
       
                // Increasing the current row.
                intRow++;
               
                // Getting the next document from the collection.
                document = documentCollection.getNextDocument();
            }
     
            // Summing all specific amounts.
            insertIntoCell(intColumn + 3, intRow, "=sum(D"
                           + String.valueOf( intRowToStart + 1 ) + ":D"
View Full Code Here

        //        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

    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);
View Full Code Here

  }

  public void getAllDocumentsByKey() {
    Database db = null;
    View view = null;
    DocumentCollection dc = null;
    Document doc = null;
    Document nextDoc = null;
    StringBuilder sb = new StringBuilder();
    try {
      db = ExtLibUtil.getCurrentDatabase();
      view = db.getView("allContactsByState");
      view.setAutoUpdate(false);
      Vector<String> key = new Vector<String>();
      key.add("CA");
      dc = view.getAllDocumentsByKey(key, true);
      doc = dc.getFirstDocument();
      while (doc != null) {
        nextDoc = dc.getNextDocument();
        try {
          sb.append(doc.getItemValueString("FirstName") + " " + doc.getItemValueString("LastName") + "...");
        } catch (lotus.domino.NotesException ne1) {
          ne1.printStackTrace();
        } finally {
          doc.recycle();
        }
        doc = nextDoc;
      }
    } catch (lotus.domino.NotesException ne) {
      ne.printStackTrace();
    } finally {
      try {
        dc.recycle();
      } catch (lotus.domino.NotesException ne) {

      }
    }
    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
View Full Code Here

  }

  public void getAllDocumentsByKeyNoMatch() {
    Database db = null;
    View view = null;
    DocumentCollection dc = null;
    Document doc = null;
    Document nextDoc = null;
    StringBuilder sb = new StringBuilder();
    try {
      db = ExtLibUtil.getCurrentDatabase();
      view = db.getView("allContactsByState");
      view.setAutoUpdate(false);
      Vector<String> key = new Vector<String>();
      key.add("CX");
      dc = view.getAllDocumentsByKey(key, true);
      sb.append("Getting values...");
      doc = dc.getFirstDocument();
      while (doc != null) {
        nextDoc = dc.getNextDocument();
        try {
          sb.append(doc.getItemValueString("FirstName") + " " + doc.getItemValueString("LastName") + "...");
        } catch (lotus.domino.NotesException ne1) {
          ne1.printStackTrace();
        } finally {
          doc.recycle();
        }
        doc = nextDoc;
      }
      sb.append("Done");
    } catch (lotus.domino.NotesException ne) {
      ne.printStackTrace();
    } finally {
      try {
        dc.recycle();
      } catch (lotus.domino.NotesException ne) {

      }
    }
    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
View Full Code Here

TOP

Related Classes of lotus.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.