Package org.openntf.domino

Examples of org.openntf.domino.Document


  public Object get(final String key) {
    String hashKey = checksum(key, "MD5");
    Database keyDB = getDatabaseForKey(hashKey);

    Document keyDoc = keyDB.getDocumentWithKey(key);
    return keyDoc == null ? null : keyDoc.get("Value");
  }
View Full Code Here


  public void put(final String key, final Object value) {
    String hashKey = checksum(key, "MD5");
    Database keyDB = getDatabaseForKey(hashKey);

    Document keyDoc = keyDB.getDocumentWithKey(key, true);

    keyDoc.replaceItemValue("Value", value);
    keyDoc.save();
  }
View Full Code Here

    private void iterateForms(final Database db) {
      System.out.println("Thread " + Thread.currentThread().getName() + " BEGINNING ITERATION of Forms");
      Vector<Form> forms = db.getForms();
      for (Form form : forms) {
        // System.out.println("Form : " + form.getName() + " (" + DominoUtils.getUnidFromNotesUrl(form.getNotesURL()) + ")");
        Document d = form.getDocument();
        Vector<Object> v = d.getItemValue("$UpdatedBy");

        Name n = db.getParent().createName((String) v.get(0));
        @SuppressWarnings("unused")
        String cn = n.getCommon();
        nameCount++;
View Full Code Here

    private void iterateForms(final Database db) {
      System.out.println("Thread " + Thread.currentThread().getName() + " BEGINNING ITERATION of Forms");
      Vector<Form> forms = db.getForms();
      for (Form form : forms) {
        // System.out.println("Form : " + form.getName() + " (" + DominoUtils.getUnidFromNotesUrl(form.getNotesURL()) + ")");
        Document d = form.getDocument();
        Vector v = d.getItemValue("$UpdatedBy");

        Name n = db.getParent().createName((String) v.get(0));
        String cn = n.getCommon();
        nameCount++;
        docCount++;
View Full Code Here

  static class DocCreator implements Runnable {

    @Override
    public void run() {
      Document doc = null;
      System.out.println("START Creation of Documents:" + new Date().toString());
      Session s = Factory.getSession();
      Set<Document> docset = new HashSet<Document>();
      Database db = s.getDatabase("", "OneMillion.nsf", true);
      if (!db.isOpen()) {
        Database db2 = s.getDatabase("", "billing.ntf", true);
        db = db2.createCopy("", "OneMillion.nsf");
        if (!db.isOpen())
          db.open();
      }

      for (int i = 1; i < 200000; i++) {

        doc = db.createDocument();
        doc.replaceItemValue("form", "doc");
        doc.replaceItemValue("Subject", String.valueOf(System.nanoTime()));
        doc.save();
        if (i % 5000 == 0) {
          // System.gc();
          docset.add(doc);
          System.out.println("Created " + i + " documents so far. Still going...");
        }
View Full Code Here

      if (this.session != null) {
        s = this.session;
        db = this.database;
        try {
          StringBuilder sb = new StringBuilder();
          Document doc = db.createDocument();
          doc.put("FirstName", "Aaron");
          doc.put("LastName", "Monroe");
          View view = db.getView("AllContacts");
          ArrayList<String> key = new ArrayList<String>();
          key.add(doc.getItemValueString("FirstName"));
          key.add(doc.getItemValueString("LastName"));
          if (view.checkUnique(key, doc)) {
            sb.append("No document yet exists with name Aaron Monroe");
          } else {
            sb.append("Document already exists with name Aaron Monroe");
          }
View Full Code Here

  static class DocCreator implements Runnable {

    @Override
    public void run() {
      Document doc = null;
      System.out.println("START Creation of Documents");
      Session s = Factory.getSession();
      Set<Document> docset = new HashSet<Document>();
      Database db = s.getDatabase("", "OneMillion.nsf", true);
      if (!db.isOpen()) {
        Database db2 = s.getDatabase("", "billing.ntf", true);
        db = db2.createCopy("", "OneMillion.nsf");
        if (!db.isOpen())
          db.open();
      }

      for (int i = 1; i < 1000000; i++) {

        doc = db.createDocument();
        doc.replaceItemValue("form", "doc");
        doc.replaceItemValue("Subject", String.valueOf(System.nanoTime()));
        doc.save();
        if (i % 5000 == 0) {
          // System.gc();
          docset.add(doc);
          System.out.println("Created " + i + " documents so far. Still going...");
        }
View Full Code Here

    Session session = this.getSession();
    Database db = session.getDatabase("", "log.nsf");
    int i = 0;
    try {
      for (i = 0; i < 5; i++) {
        Document doc = db.createDocument();
        System.out
            .println("doc " + i + " " + doc.getUniversalID() + ": " + doc.getNoteID() + " " + String.valueOf(doc.isNewNote()));
        //        doc.replaceItemValue("form", "junk");
        doc.save();
        System.out
            .println("doc " + i + " " + doc.getUniversalID() + ": " + doc.getNoteID() + " " + String.valueOf(doc.isNewNote()));
      }
    } catch (Throwable t) {
      t.printStackTrace();
    }
View Full Code Here

  static class DocCreator implements Runnable {

    @Override
    public void run() {
      Document doc = null;
      System.out.println("START Creation of Documents");
      Session s = Factory.getSession();
      Set<Document> docset = new HashSet<Document>();
      Database db = s.getDatabase("", "OneMillion.nsf", true);
      if (!db.isOpen()) {
        Database db2 = s.getDatabase("", "billing.ntf", true);
        db = db2.createCopy("", "OneMillion.nsf");
        if (!db.isOpen())
          db.open();
      }

      for (int i = 1; i < 1000000; i++) {

        doc = db.createDocument();
        doc.replaceItemValue("form", "doc");
        doc.replaceItemValue("Subject", String.valueOf(System.nanoTime()));
        doc.save();

        if (i % 5000 == 0) {
          // System.gc();
          docset.add(doc);
          System.out.println("Created " + i + " documents so far. Still going...");
View Full Code Here

      }
      Vector<Form> forms = db.getForms();
      System.out.println("Thread " + Thread.currentThread().getName() + " BEGINNING ITERATION of Forms");
      for (Form form : forms) {
        // System.out.println("Form : " + form.getName() + " (" + DominoUtils.getUnidFromNotesUrl(form.getNotesURL()) + ")");
        Document d = form.getDocument();
        Vector<Object> v = d.getItemValue("$UpdatedBy");

        Name n = s.createName((String) v.get(0));
        nameCount++;
        docCount++;
        // System.out.println("Last Editor: " + n);
View Full Code Here

TOP

Related Classes of org.openntf.domino.Document

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.