Package org.openntf.domino

Examples of org.openntf.domino.Document$Schema


            return doc;
        }

        private void addSchema(Document doc, String id, SimpleFeatureType featureType) {
            Schema schema = doc.createAndAddSchema();
            schema.setId(id);
            schema.setName(id);
            for (AttributeDescriptor ad : featureType.getAttributeDescriptors()) {
                // skip geometry attributes
                if (ad instanceof GeometryDescriptor) {
                    continue;
                }

                SimpleField field = schema.createAndAddSimpleField();
                field.setName(ad.getLocalName());
                field.setType(getKmlFieldType(ad));
            }
        }
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");
    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

TOP

Related Classes of org.openntf.domino.Document$Schema

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.