Package lotus.domino

Examples of lotus.domino.Database


    try {
      System.out.println("Starting NotesRunner");
      Session session = NotesFactory.createSession();
      Long sessId = getLotusId(session);
      sessionid.set(sessId);
      Database db = session.getDatabase("", "names.nsf");
      System.out.println("Db id:" + getLotusId(db));
      int i = 0;
      try {
        lotus.domino.DocumentCollection allDocs = db.getAllDocuments();
        System.out.println("All Collection has " + allDocs.getCount() + " documents");
        int[] nids = new int[allDocs.getCount()];
        lotus.domino.Document doc = allDocs.getFirstDocument();
        lotus.domino.Document nextDoc = null;
        while (doc != null) {
          nextDoc = allDocs.getNextDocument(doc);
          nids[i++] = Integer.valueOf(doc.getNoteID(), 16);
          doc.recycle();
          doc = nextDoc;
        }
        System.out.println("noteid array has " + nids.length + " entries");
        allDocs.recycle();

        //        lotus.domino.DocumentCollection newColl = db.getModifiedDocuments(session.createDateTime(new java.util.Date()));
        lotus.domino.DocumentCollection newColl = db.getAllUnreadDocuments();

        System.out.println("New Coll has " + newColl.getCount() + " documents");

        //        lotus.domino.DocumentCollection emptyColl = db.createDocumentCollection();
        newColl.intersect(nids[0]);
View Full Code Here


  }

  public void run1(final Session session) throws NotesException {
    Long sessId = getLotusId(session);
    sessionid.set(sessId);
    Database db = session.getDatabase("", "names.nsf");
    System.out.println("Db id:" + getLotusId(db));
    Name name = null;
    int i = 0;
    try {
      for (i = 0; i <= 100000; i++) {
        name = session.createName(UUID.randomUUID().toString());
        getLotusId(name);
        DateTime dt = session.createDateTime(new Date());
        getLotusId(dt);
        DateTime end = session.createDateTime(new Date());
        getLotusId(end);
        DateRange dr = session.createDateRange(dt, end);
        getLotusId(dr);
        Document doc = db.createDocument();
        getLotusId(doc);
        Item i1 = doc.replaceItemValue("Foo", dr);
        getLotusId(i1);
        Item i2 = doc.replaceItemValue("Bar", dr.getText());
        getLotusId(i2);
View Full Code Here

      System.out.println("Exception at loop point " + i);
    }
  }

  public void run2(final Session session) throws NotesException {
    Database db = session.getDatabase("", "log.nsf");
    Document doc = db.createDocument();
    Item names = doc.replaceItemValue("Names", "CN=Nathan T Freeman/O=REDPILL");
    names.setAuthors(true);
    doc.replaceItemValue("form", "test");
    doc.save(true);
    String nid = doc.getNoteID();
    doc.recycle();
    doc = db.getDocumentByID(nid);
    Vector<Double> numbers = new Vector<Double>();
    numbers.add(new Double(1));
    numbers.add(new Double(2));

    doc.replaceItemValue("Names", numbers);
    doc.save(true);
    doc.recycle();
    doc = db.getDocumentByID(nid);
    names = doc.getFirstItem("Names");
    System.out.println("Names is " + names.getType() + " with " + names.isNames() + " and " + names.isAuthors() + " and value "
        + names.getText());
    doc.recycle();
    db.recycle();
  }
View Full Code Here

    doc.recycle();
    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 run() {
    try {
      System.out.println("Starting NotesRunner");
      Session session = NotesFactory.createSession();
      sessionid.set(getLotusId(session));
      Database db = session.getDatabase("", "log.nsf");
      getLotusId(db);
      Name name = null;
      int i = 0;
      try {
        for (i = 0; i <= 100000; i++) {
          name = session.createName(UUID.randomUUID().toString());
          getLotusId(name);
          DateTime dt = session.createDateTime(new Date());
          getLotusId(dt);
          DateTime end = session.createDateTime(new Date());
          getLotusId(end);
          DateRange dr = session.createDateRange(dt, end);
          getLotusId(dr);
          Document doc = db.createDocument();
          getLotusId(doc);
          Item i1 = doc.replaceItemValue("Foo", dr);
          getLotusId(i1);
          Item i2 = doc.replaceItemValue("Bar", dr.getText());
          getLotusId(i2);
View Full Code Here

    Document secondDoc = null;
    DateTime firstDate = null;
    DateTime secondDate = null;
    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threadsByDate = currDb.getView("AllThreadsByDate");
      threadsByDate.setAutoUpdate(false);
      ViewNavigator vNav = threadsByDate.createViewNav();
      vNav.setEntryOptions(lotus.domino.ViewNavigator.VN_ENTRYOPT_NOCOLUMNVALUES);
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(20);
View Full Code Here

    Document secondDoc = null;
    DateTime firstDate = null;
    DateTime secondDate = null;
    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threadsByDate = currDb.getView("AllThreadsByDate");
      threadsByDate.setAutoUpdate(false);
      ViewNavigator vNav = threadsByDate.createViewNav();
      vNav.setEntryOptions(lotus.domino.ViewNavigator.VN_ENTRYOPT_NOCOLUMNVALUES);
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(20);
View Full Code Here

    Document secondDoc = null;
    DateTime firstDate = null;
    DateTime secondDate = null;
    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threads = currDb.getView("AllThreads");
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(100);
      firstDoc = threads.getNthDocument(randomInt);
      randomInt = randomGenerator.nextInt(100);
      secondDoc = threads.getNthDocument(randomInt);
View Full Code Here

    Document secondDoc = null;
    DateTime firstDate = null;
    DateTime secondDate = null;
    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threads = currDb.getView("AllThreads");
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(100);
      firstDoc = threads.getNthDocument(randomInt);
      randomInt = randomGenerator.nextInt(100);
      secondDoc = threads.getNthDocument(randomInt);
View Full Code Here

    Document secondDoc = null;
    DateTime firstDate = null;
    DateTime secondDate = null;
    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threads = currDb.getView("AllThreads");
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(100);
      firstDoc = threads.getNthDocument(randomInt);
      randomInt = randomGenerator.nextInt(100);
      secondDoc = threads.getNthDocument(randomInt);
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.