Package lotus.domino

Examples of lotus.domino.Database


  public void getProcessedDate() {
    View threads = null;
    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threads = currDb.getView("AllContacts");
      Document doc = threads.getFirstDocument();
      DateTime dt = s.createDateTime(new Date());
      doc.replaceItemValue("testDate", dt);
      doc.save(true, false);
      if (doc.hasItem("testDate")) {
View Full Code Here


    try {
      System.out.println("Starting NotesRunner");
      Session session = NotesFactory.createSession();
      Long sessId = getLotusId(session);
      sessionid.set(sessId);
      Database db = session.getDatabase("", "events4.nsf");
      System.out.println("Db id:" + getLotusId(db));
      try {
        lotus.domino.Document doc = null;
        lotus.domino.Document nextDoc = null;

        lotus.domino.DocumentCollection allDocs = db.getAllDocuments();
        System.out.println("All Collection has " + allDocs.getCount() + " documents");
        int[] nids = new int[allDocs.getCount()];

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

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

    db.recycle();

  }

  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);
      out.close();
    } catch (Throwable t) {
View Full Code Here

      try {
        Document doc = null;
        System.out.println("START Creation of Documents:" + new Date().toString());
        Session s = NotesFactory.createSession();
        Set<Document> docset = new HashSet<Document>();
        Database db = s.getDatabase("", "OneMillionLotus.nsf", true);
        if (!db.isOpen()) {
          Database db2 = s.getDatabase("", "billing.ntf", true);
          db = db2.createCopy("", "OneMillionLotus.nsf");
          if (!db.isOpen())
            db.open();
        }

        for (int i = 1; i < 200000; i++) {
View Full Code Here

  public OldViewBean() {

  }

  public void processView() {
    Database db = null;
    View view = null;
    ViewEntryCollection collection = null;
    ViewEntry currentEntry = null;
    ViewEntry nextEntry = null;
    StringBuilder sb = new StringBuilder();
    try {
      db = ExtLibUtil.getCurrentDatabase();
      view = db.getView("allStates");
      view.setAutoUpdate(false);
      collection = view.getAllEntries();
      currentEntry = collection.getFirstEntry();
      while (currentEntry != null) {
        nextEntry = collection.getNextEntry(currentEntry);
View Full Code Here

    }
    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

  public void getAllEntriesByKey() {
    Database db = null;
    View view = null;
    ViewEntryCollection ec = null;
    ViewEntry entry = null;
    ViewEntry nextEntry = 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");
      ec = view.getAllEntriesByKey(key, true);
      entry = ec.getFirstEntry();
View Full Code Here

    }
    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

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

    }
    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

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

    }
    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

  public void getAllEntriesByKeyNoMatch() {
    Database db = null;
    View view = null;
    ViewEntryCollection ec = null;
    ViewEntry entry = null;
    ViewEntry nextEntry = 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");
      ec = view.getAllEntriesByKey(key, true);
      sb.append("Getting values...");
View Full Code Here

  }

  public void getCreated() {
    try {
      Database currDb = ExtLibUtil.getCurrentDatabase();
      View contacts = currDb.getView("AllContacts");
      Document doc = contacts.getFirstDocument();
      SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy hh:mm");
      String formatted = format.format(doc.getCreated().toJavaDate());
      ExtLibUtil.getViewScope().put("oldJavaTest", formatted);
    } catch (NotesException e) {
View Full Code Here

TOP

Related Classes of lotus.domino.Database

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.