Package org.openntf.domino

Examples of org.openntf.domino.Session


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

  public void dateTimeEqualsIgnoreDateTest() {
    StringBuilder sb = new StringBuilder();
    Session s = Factory.getSession();
    Database currDb = s.getCurrentDatabase();
    View threads = currDb.getView("AllThreads");
    Random randomGenerator = new Random();
    int randomInt = randomGenerator.nextInt(100);
    Document firstDoc = threads.getNthDocument(randomInt);
    randomInt = randomGenerator.nextInt(100);
    Document secondDoc = threads.getNthDocument(randomInt);
    String firstDt = firstDoc.getFirstItem("Date").getText();
    String secondDt = secondDoc.getFirstItem("Date").getText();
    DateTime firstDate = s.createDateTime(firstDt);
    DateTime secondDate = s.createDateTime(secondDt);
    sb.append("Comparing " + firstDt + " (" + firstDoc.getUniversalID() + ") with " + secondDt + " ("
        + secondDoc.getUniversalID() + ")...");
    if (firstDate.equalsIgnoreDate(secondDate)) {
      sb.append("first is the same time as second");
    } else {
View Full Code Here


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

  public void dateTimeEqualsIgnoreTimeTest() {
    StringBuilder sb = new StringBuilder();
    Session s = Factory.getSession();
    Database currDb = s.getCurrentDatabase();
    View threads = currDb.getView("AllThreads");
    Random randomGenerator = new Random();
    int randomInt = randomGenerator.nextInt(100);
    Document firstDoc = threads.getNthDocument(randomInt);
    randomInt = randomGenerator.nextInt(100);
    Document secondDoc = threads.getNthDocument(randomInt);
    String firstDt = firstDoc.getFirstItem("Date").getText();
    String secondDt = secondDoc.getFirstItem("Date").getText();
    DateTime firstDate = s.createDateTime(firstDt);
    DateTime secondDate = s.createDateTime(secondDt);
    sb.append("Comparing " + firstDt + " (" + firstDoc.getUniversalID() + ") with " + secondDt + " ("
        + secondDoc.getUniversalID() + ")...");
    if (firstDate.equalsIgnoreTime(secondDate)) {
      sb.append("first is the same date as second");
    } else {
View Full Code Here

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

  public void getProcessedDate() {
    Session s = Factory.getSession();
    Database currDb = s.getCurrentDatabase();
    Utils.addAllListeners(currDb);
    View threads = currDb.getView("AllContacts");
    Document doc = threads.getFirstDocument();
    DateTime dt = s.createDateTime(new Date());
    doc.put("testDate", dt);
    doc.save(true, false);
    ExtLibUtil.getViewScope().put("javaTest", doc.get("testDate").toString());
  }
View Full Code Here

    // whatever you might want to do in your constructor, but stay away from Domino objects
  }

  @Override
  public void run() {
    Session session = this.getSession();
    session.setConvertMIME(false);
    session.setFixEnable(Fixes.APPEND_ITEM_VALUE, true);
    session.setFixEnable(Fixes.FORCE_JAVA_DATES, true);
    session.setFixEnable(Fixes.CREATE_DB, true);
    Database db = session.getDatabase("", "log.nsf");
    Document doc = db.createDocument();
    doc.replaceItemValue("form", "Events");
    doc.replaceItemValue("Server", "Test");
    Map<String, String> map = new HashMap<String, String>();
    map.put("me", "us");
    map.put("myself", "ourselves");
    map.put("I", "we");
    doc.replaceItemValue("map", map);
    doc.save();
    String unid = doc.getUniversalID();
    doc = null;
    Document docJunk = db.createDocument();
    doc = db.getDocumentByUNID(unid);
    System.out.println(doc.getNoteID());
    Object o = doc.getItemValue("map", Map.class);
    System.out.println(o.getClass().getName());
    Map<String, String> remap = (Map<String, String>) o;

    for (String key : remap.keySet()) {
      System.out.println(key + ":" + remap.get(key));
    }
    session.setConvertMIME(true);
    doc = null;
    docJunk = db.createDocument();
    doc = db.getDocumentByUNID(unid);
    Vector<Item> items = doc.getItems();
    for (Item item : items) {
      if (item.getName().equalsIgnoreCase("map")) {
        System.out.println("map: " + item.getType());
        System.out.println("map value: " + item.getText());
      }
    }
    doc.replaceItemValue("foo", "bar");
    doc.save();
    session.setConvertMIME(false);
    o = null;
    doc = null;
    docJunk = db.createDocument();
    doc = db.getDocumentByUNID(unid);
    o = doc.getItemValue("map", Map.class);
View Full Code Here

    System.out.println("Complete");
  }

  protected Session getSession() {
    try {
      Session session = Factory.fromLotus(NotesFactory.createSession(), Session.class, null);
      return session;
    } catch (Throwable t) {
      DominoUtils.handleException(t);
      return null;
    }
View Full Code Here

    // whatever you might want to do in your constructor, but stay away from Domino objects
  }

  @Override
  public void run() {
    Session sess = Factory.getSession();
    boolean succ = true;
    char[] c = new char[1];
    int[] payloads = new int[2];
    Vector<String> diffv = new Vector<String>();
    try {
View Full Code Here

    // whatever you might want to do in your constructor, but stay away from Domino objects
  }

  @Override
  public void run() {
    Session s = Factory.getSession();
    Database d = s.getDatabase("", "names.nsf");
    List<String> ids = new ArrayList<String>();

    Collection<Document> documents = d.getAllDocuments();

    for (Document doc : documents) {
      ids.add(doc.getNoteID());
    }
    //System.out.println("IDS.size " + ids.size());
    for (int i = 1; i < 100; i++) {
      System.out.println(i + ": " + Factory.dumpCounters(false));
      Document doc1 = null;
      Document doc2 = null;
      Document doc3 = null;
      for (String id : ids) {
        d = s.getDatabase("", "names.nsf");
        doc1 = d.getDocumentByID(id);
        doc1 = null;
        doc2 = d.getDocumentByID(id);
        doc2 = null;
        doc3 = d.getDocumentByID(id);
View Full Code Here

  }

  @Override
  public void run() {
    try {
      Session sess = this.getSession();
      Database db = sess.getDatabase(getApiPath());

      String msg = "User is " + sess.getEffectiveUserName();
      msg = msg + " access is " + Integer.toString(db.getCurrentAccessLevel());
      System.out.println(msg);
      getApplicationScope().put("MessageFromXots", msg + "(set from Xots method)");
    } catch (Throwable t) {
      t.printStackTrace();
View Full Code Here

  }

  @Override
  public void run() {
    try {
      Session sess = getSession();
      Date now = new Date();
      String msg = "Running Xots " + now.toString();
      msg = msg + "\n " + sess.getEffectiveUserName() + " is on server " + String.valueOf(sess.isOnServer());
      Database db = sess.getDatabase("log.nsf");
      msg = msg + "\n" + "Log at " + db.getApiPath() + " is " + db.getSize();
      System.out.println(msg);
      ExtLibUtil.getApplicationScope().put("MessageFromXotsSchedule", msg);
      XspOpenLogUtil.logEvent(new Throwable(msg), msg, Level.FINE, null);
    } catch (Throwable t) {
View Full Code Here

    }
    if (module_ != null) {
      NotesContext nctx = new NotesContext(module_);
      NotesContext.contextThreadLocal.set(nctx);
    }
    Session session = this.getNamedSession();
    setSession(session);
  }
View Full Code Here

TOP

Related Classes of org.openntf.domino.Session

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.