Package org.openntf.domino

Examples of org.openntf.domino.Database


  // Import data
  // ===================================================================

  public void run() throws IOException {
    try {
      Database db = Factory.getSession().getCurrentDatabase();
      if (deleteAllDoc) {
        deleteAllDocuments(db);
      }
      if (createUsers) {
        createUsers(db);
View Full Code Here


      date = new Date();
      retVal += "<br/>Finished standard version..." + date.toString();
      date = new Date();
      retVal += "<br/>Starting OpenNTF version..." + date.toString();
      Session currSess = Factory.getSession();
      Database currDb = currSess.getCurrentDatabase();
      Utils.addAllListeners(currDb);
      View contactsView = currDb.getView("AllContacts");
      for (ViewEntry ent : contactsView.getAllEntries()) {
        DateTime dt = currSess.createDateTime(new Date());
        Document doc = ent.getDocument();
        doc.replaceItemValue("testDate", dt);
        doc.save(true, false);
View Full Code Here

  public static void openLogTest() {
    XspOpenLogUtil.logError(new Throwable("This is a test of XspOpenLogUtil"));
  }

  public static void openLogUtilTest() {
    Database db = Factory.getSession().getCurrentDatabase();
    View view = db.getView("allStates");
    Document doc = view.getFirstDocument();
    XspOpenLogUtil.getXspOpenLogItem().logEvent(null, "Test message", Level.FINE, doc);
  }
View Full Code Here

    XspOpenLogUtil.getXspOpenLogItem().logEvent(null, "Test message", Level.FINE, doc);
  }

  public static void transactionTest(boolean successOrFail) {
    StringBuilder sb = new StringBuilder();
    Database db = Factory.getSession().getCurrentDatabase();
    Utils.addAllListeners(db);
    DatabaseTransaction txn = db.startTransaction();
    try {
      String selVal = (String) ExtLibUtil.getViewScope().get("selectedState");
      boolean toggle = true;
      int count = 0;
      if ("".equals(selVal)) {
        ExtLibUtil.getViewScope().put("javaTest", "First select a value");
        return;
      }
      sb.append("Starting update with " + selVal);
      View view = db.getView("allStates");
      Document state = view.getFirstDocumentByKey(selVal, true);
      state.replaceItemValue("txnTest", new Date());
      sb.append("...Updated State pending committal, value is " + state.get("txnTest").toString());
      View contacts = db.getView("AllContactsByState");
      DocumentCollection dc = contacts.getAllDocumentsByKey(selVal, true);
      for (Document doc : dc) {
        if (toggle) {
          doc.replaceItemValue("txnTest", new Date());
          count += 1;
View Full Code Here

  public static void contactScannerMap() {
    DocumentScanner scanner = new DocumentScanner();
    scanner.setIgnoreDollar(true);

    Database db = Factory.getSession().getCurrentDatabase();
    View contacts = db.getView("AllContacts");
    for (ViewEntry ent : contacts.getAllEntries()) {
      scanner.processDocument(ent.getDocument());
    }

    ExtLibUtil.getViewScope().put("scannerFieldTokenMap", scanner.getFieldTokenMap());
View Full Code Here

    ExtLibUtil.getViewScope().put("scannerFieldTypeMap", scanner.getFieldTypeMap());
    ExtLibUtil.getViewScope().put("scannerTokenFreqMap", scanner.getTokenFreqMap());
  }

  public static Database getCurrDb() {
    Database retVal_ = Factory.getSession().getCurrentDatabase();
    addAllListeners(retVal_);
    return retVal_;
  }
View Full Code Here

  }

  public void doGetPut() {
    Session s = Factory.getSession();
    Database currDb = s.getCurrentDatabase();
    Utils.addAllListeners(currDb);
    View threads = currDb.getView("AllContacts");
    Document doc = threads.getFirstDocument();
    if (!doc.hasItem("documentToggle")) {
      doc.put("documentToggle", true);
    } else {
      doc.put("documentToggle", null);
View Full Code Here

  }

  public void containsCheckItems() {
    StringBuilder sb = new StringBuilder();
    Session s = Factory.getSession();
    Database currDb = s.getCurrentDatabase();
    View contacts = currDb.getView("AllContacts");
    ArrayList<String> items = new ArrayList<String>();
    items.add("FirstName");
    items.add("LastName");
    items.add("City");
    int count = 0;
View Full Code Here

      RunContext rc = Factory.getRunContext();
      //      System.out.println("RunContext: " + rc.toString());
      Name sname = s.getUserNameObject();
      DateFormat df = new SimpleDateFormat("yyyyMMddhhmmss");
      //      System.out.println(df.format(new Date()) + " Name: " + sname.getCanonical());
      Database db = s.getDatabase(server, dbPath);

      if (INCLUDE_FORMS) {
        iterateForms(db);
      }
      Set<Document> secondReference = new HashSet<Document>();
      iterateAllDocuments(db, secondReference);
      //      System.gc();
      NoteCollection nc = db.createNoteCollection(false);
      nc.buildCollection();
      iterateSecondReferences(secondReference);
      iterateThirdReferences();

      View view = db.getView("NameMessageEventMessages");
      List<String> keys = new ArrayList<String>();
      keys.add("Mail");
      keys.add("2");
      DocumentCollection dc = view.getAllDocumentsByKey(keys, false);
      System.out.println("dc: " + dc.getCount());
View Full Code Here

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

  public void getCreated() {
    Session s = Factory.getSession();
    Database currDb = s.getCurrentDatabase();
    View contacts = currDb.getView("AllContacts");
    Document doc = contacts.getFirstDocument();
    SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy hh:mm");
    String formatted = format.format(doc.getCreatedDate());
    ExtLibUtil.getViewScope().put("javaTest", formatted);
  }
View Full Code Here

TOP

Related Classes of org.openntf.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.