Package org.openntf.domino

Examples of org.openntf.domino.Item


    View contacts = currDb.getView("AllContacts");
    Utils.addAllListeners(currDb);
    Document doc = contacts.getFirstDocument();
    StringBuilder sb = new StringBuilder();
    sb.append("Here is a value");
    Item itm = doc.replaceItemValue("summaryField", sb, true);
    doc.save(true, false);
    ExtLibUtil.getViewScope().put("javaTest", doc.get("summaryField") + " " + Boolean.toString(itm.isSummary()));
  }
View Full Code Here


    try {
      Session s = Factory.getSession();
      Database currDb = s.getCurrentDatabase();
      View contacts = currDb.getView("AllContacts");
      Document doc = contacts.getFirstDocument();
      Item testItem = doc.replaceItemValue("muppetField", 1);
      testItem.setNames(true);
      doc.save(true, false);
    } catch (Throwable t) {
      ExtLibUtil.getViewScope().put("javaTest", t.getClass().getName() + ": " + t.getLocalizedMessage());
    }
  }
View Full Code Here

      StringBuilder sb = new StringBuilder();
      Session s = Factory.getSession();
      Database currDb = s.getCurrentDatabase();
      View contacts = currDb.getView("AllContacts");
      Document doc = contacts.getFirstDocument();
      Item testItem = doc.replaceItemValue("readersAuthorsNamesField", s.getEffectiveUserName());
      sb.append("Checking if Item is Readers, Names or Authors...");
      sb.append(testItem.isReadersNamesAuthors());
      testItem.setNames(true);
      testItem.setAuthors(true);
      testItem.setReaders(true);
      sb.append("<br/>Checking if Item is Readers, Names or Authors...");
      sb.append(testItem.isReadersNamesAuthors());
      doc.save(true, false);
      sb.append("<br/>Success!!");
      ExtLibUtil.getViewScope().put("javaTest", sb.toString());
    } catch (Throwable t) {
View Full Code Here

      long documentTime = System.nanoTime();
      documentBuildNS = documentTime - collectionTime;
      int pageSize = 1000;
      int pageStart = 2014;
      for (int i = pageStart; i < (pageStart + pageSize); i++) {
        Item titleItem = documents[i].getFirstItem("Title");
        titleItem.isAuthors();
        titleItem.isEncrypted();
        titleItem.isNames();
        titleItem.isProtected();
        titleItem.isReaders();
        titleItem.isSigned();
        titleItem.isSummary();
        String report = documents[i].getNoteID() + " is a " + titleItem.getText();
        //        System.out.println(report);
        //        report = report + (" Summary: " + String.valueOf());
      }
      documentPageNS = System.nanoTime() - documentTime;
View Full Code Here

  public String getHitContext(final Session session, final String serverName) {
    String result = "";
    Document doc = getDocument(session, serverName);
    if (doc != null && doc.isValid() && !doc.getItems().isEmpty()) {
      Item hitItem = doc.getFirstItem(getItem());
      if (hitItem.getType() == Item.RICHTEXT) {
        //TODO NTF - possibly add some HTML formatting stuff...
      } else {

      }
      String text = hitItem.getValueString();
      int pos = text.indexOf(getTerm());
      if (pos > 30) {
        if (text.length() < 60) {
          result = text.substring(pos - 30, text.length());
        } else {
View Full Code Here

        defaultValue = dt;
      } else {
        defaultValue = null;
      }
    }
    Item item = null;
    if (defaultValue != null) {
      item = doc.replaceItemValue(name, defaultValue);
    } else {
      try {
        item = doc.replaceItemValueCustomDataBytes(name, "", new byte[1]);
      } catch (IOException e) {
        DominoUtils.handleException(e);
      }
    }
    if (item != null) {
      if (!def.isDefaultSummary()) {
        item.setSummary(false);
      }
      for (Flags flag : getFlags()) {
        switch (flag) {
        case SUMMARY:
          item.setSummary(true);
          break;
        case AUTHORS:
          item.setAuthors(true);
          break;
        case READERS:
          item.setReaders(true);
          break;
        case PROTECTED:
          item.setProtected(true);
          break;
        case SIGNED:
          item.setSigned(true);
          break;
        case ENCRYPTED:
          item.setEncrypted(true);
          break;
        }
      }
    }
    return item;
View Full Code Here

    result.replaceItemValue("$$SchemaType", doctype);
    result.replaceItemValue("form", def.getName());
    Map<String, IItemDefinition> itemDefs = def.getItemDefinitions();
    for (String key : itemDefs.keySet()) {
      IItemDefinition itemDef = itemDefs.get(key);
      Item item = itemDef.createDefaultItem(result, def);
    }

    return result;
  }
View Full Code Here

   */
  @SuppressWarnings({ "rawtypes", "unchecked" })
  @Override
  public Item appendItemValue(final String name, final Object value, final boolean unique) {
    checkMimeOpen();
    Item result = null;
    if (unique && hasItem(name)) {
      // TODO RPr This function is not yet 100% mime compatible
      // Once mime compatible, remove the reference in org.openntf.domino.ext.Document Javadoc
      result = getFirstItem(name);
      if (result.containsValue(value)) { // this does not work when it is not dominoFriendly
        return result;
      }
    }
    try {
      if (!hasItem(name)) {
View Full Code Here

    // TODO - NTF markDirty()? Yes. It's necessary.
    // TODO RPr: ConvertMime?
    checkMimeOpen();
    beginEdit();
    try {
      Item ret = fromLotus(getDelegate().copyItem(toLotus(item), newName), Item.SCHEMA, this);
      markDirty(ret.getName(), true);
      return ret;
    } catch (NotesException e) {
      DominoUtils.handleException(e, this);
    }
    return null;
View Full Code Here

          wrapped.initItemName(itemName);
          markDirty(itemName, true);
        }
        return wrapped;
      } catch (NotesException alreadyThere) {
        Item chk = getFirstItem(itemName);
        if (chk != null) {
          log_.log(Level.WARNING,
              "Already found an item for " + itemName + " that is type: " + (chk == null ? "null" : chk.getTypeEx()));
          removeItem(itemName);
        } else {
          MIMEEntity me = getMIMEEntity(itemName);
          markDirty(itemName, true);
          return me;
View Full Code Here

TOP

Related Classes of org.openntf.domino.Item

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.