Package org.openntf.domino

Examples of org.openntf.domino.Document


  }

  private Document createDocument() {
    if (db == null)
      db = Factory.getSession().getDatabase("", "log.nsf");
    Document doc = db.createDocument();
    return doc;
  }
View Full Code Here


    for (int i = 0; i < count; i++) {

      // Setup procedure, prepare the demo docs & maps
      time = System.nanoTime();
      double rnd = Math.random();
      Document ntfDoc = createDocument();
      Document lotusDoc = createDocument();
      Map<String, Object> ntfMap = new HashMap<String, Object>();

      fillDemoDoc(ntfDoc, rnd);
      fillDemoDoc(lotusDoc, rnd);
      fillDemoDoc(ntfMap, rnd);
View Full Code Here

  }

  private Document createDocument() {
    if (db == null)
      db = Factory.getSession().getDatabase("", "log.nsf");
    Document doc = db.createDocument();
    return doc;
  }
View Full Code Here

    for (int i = 0; i < count; i++) {

      // Setup procedure, prepare the demo docs & maps
      time = System.nanoTime();
      double rnd = Math.random();
      Document ntfDoc = createDocument();
      Document lotusDoc = createDocument();
      Map<String, Object> ntfMap = new HashMap<String, Object>();

      fillDemoDoc(ntfDoc, rnd);
      fillDemoDoc(lotusDoc, rnd);
      fillDemoDoc(ntfMap, rnd);
View Full Code Here

  private Document createDocument() {
    if (db == null)
      db = Factory.getSession().getDatabase("", "log.nsf");
    try {
      Document doc = db.createDocument();
      return doc;
    } catch (NullPointerException npe) {
      System.err.println("Cannot create demo doc. Is your server running?");
      return null;
    }
View Full Code Here

    boolean parserFailed = false;
    // Setup procedure, prepare the demo docs & maps
    StringBuffer errors = new StringBuffer();

    double rnd = Math.random();
    Document ntfDoc = createDocument();
    Document lotusDoc = createDocument();
    Map<String, Object> ntfMap = new HashMap<String, Object>();

    fillDemoDoc(ntfDoc, rnd);
    fillDemoDoc(lotusDoc, rnd);
    fillDemoDoc(ntfMap, rnd);
View Full Code Here

    }

  }

  void createUser(Database db, String id, String firstName, String lastName, String city, String state, String email) {
    Document doc = db.createDocument("Form", "Contact", "Id", id, "FirstName", firstName, "LastName", lastName,
        "City", city, "State", state, "email", email);
    doc.save();
  }
View Full Code Here

    }

  }

  void createState(Database db, String key, String name) {
    Document doc = db.createDocument("Form", "State", "Key", key, "Name", name);
    doc.save();
  }
View Full Code Here

    DateTime date = db.getParent().createDateTime(new Date());
    String[] loremIpsum = SampleDataUtil.readLoremIpsum();
    for (int j = 0; j < nDoc; j++) {
      pos[pos.length - 1] = j + 1;

      Document doc = db.createDocument();
      doc.replaceItemValue("Form", "Discussion");
      StringBuilder b = new StringBuilder();
      for (int i = 0; i < pos.length; i++) {
        if (i > 0) {
          b.append("/");
        }
        b.append(pos[i]);
      }
      int idx = (int) (Math.random() * (loremIpsum.length - 1));
      String body = loremIpsum[idx];
      int dot = body.indexOf('.');
      if (dot < 0) {
        dot = body.length() - 1;
      }
      int coma = body.indexOf(',');
      if (coma < 0) {
        coma = body.length() - 1;
      }
      String title = body.substring(0, Math.min(dot, coma));

      // Get a random author
      int x = Math.min((int) (Math.random() * (users.size())), users.size());
      String author = users.get(x);

      doc.replaceItemValue("Title", title);
      doc.replaceItemValue("Body", body);
      doc.replaceItemValue("Author", author);
      doc.replaceItemValue("Date", date);
      if (parent != null) {
        doc.makeResponse(parent);
      }
      doc.computeWithForm(false, false);
      doc.save();

      if (pos.length < disc_maxDepth) {
        double r = Math.random();
        if (r <= (1.0 / pos.length)) {
          int[] newPos = new int[pos.length + 1];
View Full Code Here

  }

  void createAllType(Database db, int index) {
    Session session = db.getParent();
    String sIndex = Integer.toString(index);
    Document doc = db.createDocument();
    doc.put("Form", "AllTypes");

    doc.put("fldIcon", index);
    doc.put("fldText", "text_" + sIndex);
    doc.put("fldNumber", index * 100);
    doc.put("fldDate", createDate(2012, Calendar.JANUARY, index));
    doc.put("fldTime", createTime(session, 5, 1, index));
    doc.put("fldDateTime", createDateTime(2011, 2, index, 8, 9, index));
    doc.put("fldDateTimeRange", createDateTimeRange(session, 2012, 3, index, 8, 9, index));
    doc.put("fldDialogList", "dlg_" + sIndex);

    ArrayList<String> mx = new ArrayList<String>();
    mx.add("text_" + sIndex + "_1");
    mx.add("text_" + sIndex + "_2");
    mx.add("text_" + sIndex + "_3");
    doc.put("fldText2", mx);

    ArrayList<Object> mn = new ArrayList<Object>();
    mn.add(index * 100 + 1);
    mn.add(index * 100 + 2);
    mn.add(index * 100 + 3);
    doc.put("fldNumber2", mn);

    ArrayList<Date> md = new ArrayList<Date>();
    md.add(createDate(2010, Calendar.JANUARY, index));
    md.add(createDate(2010, Calendar.FEBRUARY, index));
    md.add(createDate(2010, Calendar.MARCH, index));
    doc.put("fldDate2", md);

    Vector<Date> mt = new Vector<Date>();
    mt.add(createTime(session, 6, 1, index));
    mt.add(createTime(session, 6, 2, index));
    mt.add(createTime(session, 6, 3, index));
    doc.put("fldTime2", mt);

    Vector<Date> mdt = new Vector<Date>();
    mdt.add(createDateTime(2011, 1, index, 6, 1, index));
    mdt.add(createDateTime(2011, 2, index, 6, 2, index));
    mdt.add(createDateTime(2011, 3, index, 6, 3, index));
    doc.put("fldDateTime2", mdt);

    if (false) { // DateTime range do not work with multiple values?
      Vector<DateRange> mrg = new Vector<DateRange>();
      mrg.add(createDateTimeRange(session, 2012, 2, index, 4, 1, index));
      mrg.add(createDateTimeRange(session, 2012, 3, index, 5, 1, index));
      mrg.add(createDateTimeRange(session, 2012, 4, index, 6, 1, index));
      doc.put("fldDateTimeRange2", mrg);
    }

    ArrayList<Object> mdg = new ArrayList<Object>();
    mdg.add("dlgx_" + sIndex + "_1");
    mdg.add("dlgx_" + sIndex + "_1");
    mdg.add("dlgx_" + sIndex + "_1");
    doc.put("fldDialogList2", mdg);

    doc.save();
  }
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.