Package org.openntf.domino

Examples of org.openntf.domino.Document


    }
  }

  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 {

      }
View Full Code Here


      // result.intersect(nid);
      // }

      // TODO due to a bug in 9.0, this is being reverted to highly inefficient behavior...
      for (int nid : nids) {
        Document doc = db.getDocumentByID(Integer.toHexString(nid));
        result.add(doc);
      }
    }
    return result;
  }
View Full Code Here

  /* (non-Javadoc)
   * @see org.openntf.domino.ext.View#isTimeSensitive()
   */
  @Override
  public boolean isTimeSensitive() {
    Document doc = getDocument();
    return doc.hasItem("$FormulaTV");
  }
View Full Code Here

  @Override
  public String validateEdges() {
    TextBuilder sb = new TextBuilder();
    Set<String> inIds = getInEdges();
    for (String id : inIds.toArray(new String[inIds.size()])) {
      Document chk = getParent().getRawDatabase().getDocumentByUNID(id);
      if (chk == null) {
        inIds.remove(id);
        sb.append("IN: ");
        sb.append(id);
        sb.append(",");
      }
    }

    Set<String> outIds = getOutEdges();
    for (String id : outIds.toArray(new String[outIds.size()])) {
      Document chk = getParent().getRawDatabase().getDocumentByUNID(id);
      if (chk == null) {
        outIds.remove(id);
        sb.append("OUT: ");
        sb.append(id);
        sb.append(",");
View Full Code Here

    if (result == null) {
      //      if ("PROGNAME".equalsIgnoreCase(propertyName)) {
      //        System.out.println("DEBUG: " + propertyName + " getting from Document");
      //      }
      try {
        Document doc = getRawDocument();
        result = doc.getItemValue(propertyName, T);
        if (result == null) {
          //          synchronized (props) {
          props.put(key, Null.INSTANCE);
          //          }
        } else if (result instanceof Serializable) {
          //          synchronized (props) {
          props.put(key, (Serializable) result);
          //          }
        } else {
          log_.log(Level.WARNING, "Got a value from the document but it's not Serializable. It's a "
              + result.getClass().getName());
        }
      } catch (Exception e) {
        log_.log(Level.WARNING, "Exception occured attempting to get value from document for " + propertyName
            + " so we cannot return a value", e);
      }
    } else if (result == Null.INSTANCE) {

    } else {
      if (result != null && !T.isAssignableFrom(result.getClass())) {
        //        if ("PROGNAME".equalsIgnoreCase(propertyName)) {
        //          System.out.println("DEBUG: " + propertyName + " result is a " + result.getClass().getSimpleName());
        //        }
        // System.out.println("AH! We have the wrong type in the property cache! How did this happen?");
        try {
          Document doc = getRawDocument();
          result = doc.getItemValue(propertyName, T);
          if (result == null) {
            //            synchronized (props) {
            props.put(key, Null.INSTANCE);
            //            }
          } else if (result instanceof Serializable) {
View Full Code Here

    T result = getProperty(key);
    Map<String, Serializable> props = getProps();
    //    synchronized (props) {
    props.remove(key);
    //    }
    Document doc = getRawDocument();
    synchronized (doc) {
      doc.removeItem(key);
    }
    //    synchronized (removedProperties_) {
    getRemovedPropertiesInt().add(key);
    //    }
    //    synchronized (propKeys_) {
View Full Code Here

    }
  }

  protected void reapplyChanges() {
    Map<String, Serializable> props = getProps();
    Document doc = getDocument();
    //    synchronized (props) {
    if (props.isEmpty()) {
      // System.out.println("Cached properties is empty!");
    } else {
      //        synchronized (changedProperties_) {
      // System.out.println("Re-applying cached properties: " + changedProperties_.size());
      for (String s : getChangedPropertiesInt()) {
        //        CharSequence key = new CaseInsensitiveString(s);
        String key = s;
        Object v = props.get(key);
        if (v == null) {
          // System.out.println("Writing a null value for property: " + key
          // + " to an Element document. Probably not good...");
        }
        if (s.startsWith(DominoVertex.IN_PREFIX) || s.startsWith(DominoVertex.OUT_PREFIX)) {
          doc.replaceItemValue(s, v, false);
        } else {
          doc.replaceItemValue(s, v);
        }
      }
      getChangedPropertiesInt().clear();
      //        }

    }
    //    }
    //    synchronized (removedProperties_) {
    for (String key : getRemovedPropertiesInt()) {
      doc.removeItem(key);
    }
    //    }
  }
View Full Code Here

   */
  @Override
  public Map<String, List<String>> getQueryStringParameters() {
    Map<String, List<String>> result = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);

    Document doc = getDocumentContext();
    String queryString = doc.getItemValueString("QUERY_STRING");

    for (String pair : queryString.split("&")) {
      if (!pair.isEmpty()) {
        String[] bits = pair.split("=");
        try {
View Full Code Here

  @Override
  public Document createDocument(final Database db, final String doctype) {
    DocumentDefinition def = getDocumentDefinitions().get(doctype);
    if (def == null)
      return null;
    Document result = db.createDocument();
    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);
    }
View Full Code Here

              if (null != error.getError()) {
                msg = msg + ":\n\n" + error.getError().getLocalizedMessage() + "\n\n"
                    + error.getError().getExpressionText();
              }
              Level severity = convertSeverity(error.getSeverity());
              Document passedDoc = null;
              if (!"".equals(error.getUnid())) {
                try {
                  Database currDb = Factory.getSession().getCurrentDatabase();
                  passedDoc = currDb.getDocumentByUNID(error.getUnid());
                } catch (Exception e) {
                  msg = msg + "\n\nCould not retrieve document but UNID was passed: " + error.getUnid();
                }
              }
              XspOpenLogUtil.getXspOpenLogItem().logErrorEx(error.getError(), msg, severity, passedDoc);
            }
          }
          // loop through the ArrayList of EventError objects
          if (null != errList.getEvents()) {
            for (EventError eventObj : errList.getEvents()) {
              String msg = "Event logged for ";
              if (null != eventObj.getControl()) {
                msg = msg + eventObj.getControl().getId();
              }
              msg = msg + " " + eventObj.getMsg();
              Level severity = convertSeverity(eventObj.getSeverity());
              Document passedDoc = null;
              if (!"".equals(eventObj.getUnid())) {
                try {
                  Database currDb = Factory.getSession().getCurrentDatabase();
                  passedDoc = currDb.getDocumentByUNID(eventObj.getUnid());
                } catch (Exception e) {
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.