Package org.openntf.domino

Examples of org.openntf.domino.Document$Schema


              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


      importer.importDxl(getDxl().getXml(), database);

      noteId_ = importer.getFirstImportedNoteID();

      // Reset the DXL so that it can pick up new noteinfo
      Document document = database.getDocumentByID(noteId_);
      DxlExporter exporter = getAncestorSession().createDxlExporter();
      exporter.setForceNoteFormat(true);
      exporter.setOutputDOCTYPE(false);
      loadDxl(exporter.exportDxl(document));
    } catch (IOException e) {
View Full Code Here

    }
  }

  public Map<String, byte[]> getClassData() {
    // For this one, we'll need the note in the database
    Document doc = getDocument();
    if (doc != null) {
      try {
        EmbeddedObject obj = doc.getAttachment("%%object%%.jar");

        InputStream objInputStream = obj.getInputStream();
        JarInputStream jis = new JarInputStream(objInputStream);
        JarEntry entry = jis.getNextJarEntry();
        Map<String, byte[]> classData = new TreeMap<String, byte[]>();
View Full Code Here

    }
  }

  @Override
  public String[] getXotsClassNames() {
    Document iconDoc = getDocument();
    if (iconDoc != null && iconDoc.hasItem("$Xots")) {
      String[] xotsClassNames = iconDoc.getItemValue("$Xots", String[].class);
      if (xotsClassNames != null) {
        return xotsClassNames;
      }
    }
    return new String[] {};
View Full Code Here

    //      Thread.sleep(100);
    //    } catch (InterruptedException e1) {
    //      DominoUtils.handleException(e1);
    //      return null;
    //    }
    Document result = null;
    boolean go = true;
    go = fireListener(generateEvent(Events.BEFORE_CREATE_DOCUMENT, this, null));
    if (go) {
      try {
        if (!getDelegate().isOpen()) {
View Full Code Here

   *
   * @see org.openntf.domino.Database#createDocument(java.util.Map)
   */
  @Override
  public Document createDocument(final Map<String, Object> itemValues) {
    Document doc = this.createDocument();
    for (Map.Entry<String, Object> entry : itemValues.entrySet()) {
      doc.replaceItemValue(entry.getKey(), entry.getValue());
    }
    return doc;
  }
View Full Code Here

   *
   * @see org.openntf.domino.Database#createDocument(java.lang.Object[])
   */
  @Override
  public Document createDocument(final Object... keyValuePairs) {
    Document doc = this.createDocument();
    if (keyValuePairs.length >= 2) {
      for (int i = 0; i < keyValuePairs.length; i += 2) {
        doc.replaceItemValue(keyValuePairs[i].toString(), keyValuePairs[i + 1]);
      }
    }
    return doc;
  }
View Full Code Here

  public Document getDocumentWithKey(final Serializable key, final boolean createOnFail) {
    try {
      if (key != null) {
        String checksum = DominoUtils.toUnid(key);

        Document doc = this.getDocumentByUNID(checksum);
        if (doc == null && createOnFail) {
          doc = this.createDocument();
          doc.setUniversalID(checksum);
          doc.replaceItemValue("$Created", new Date());
          doc.replaceItemValue("$$Key", key);
        }
        return doc;

      } else if (createOnFail) {
        log_.log(java.util.logging.Level.WARNING,
            "Document by key requested with null key. This is probably not what you meant to do...");
        Document doc = this.createDocument();
        doc.replaceItemValue("$Created", new Date());
        doc.replaceItemValue("$$Key", "");
        return doc;
      }
    } catch (Exception e) {
      DominoUtils.handleException(e, this);
    }
View Full Code Here

  public Locale getLocale() {
    if (getLocaleCalled)
      return dbLocale;
    getLocaleCalled = true;

    Document doc = getDesign().getIconNote().getDocument();
    if (doc == null)
      return null;
    String lStr = doc.getItemValueString("$DefaultLanguage");
    if (lStr == null || lStr.length() < 2)
      return null;
    String language = lStr.substring(0, 2).toLowerCase();
    String country = (lStr.length() >= 5 && lStr.charAt(2) == '-') ? lStr.substring(3, 5).toUpperCase() : "";
    return dbLocale = new Locale(language, country);
View Full Code Here

    result = props.get(propertyName);
    if (result == null || Deferred.INSTANCE.equals(result)) {
      try {
        Map<String, Object> delegate = getDelegate();
        if (delegate instanceof Document) {
          Document doc = (Document) delegate;
          result = doc.getItemValue(propertyName, T);
        } else {
          result = T.cast(delegate.get(propertyName));
        }
        if (result == null) {
          props.put(propertyName, Null.INSTANCE);
        } else if (result instanceof Serializable) {
          props.put(propertyName, result);
        } else {
          log_.log(Level.FINE, "Got a value from the document but it's not Serializable. It's a " + result.getClass().getName());
          props.put(propertyName, result);
        }
      } 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())) {
        try {
          Map<String, Object> delegate = getDelegate();
          if (delegate instanceof Document) {
            Document doc = (Document) delegate;
            result = doc.getItemValue(propertyName, T);
          } else {
            Object chk = delegate.get(propertyName);
            if (chk != null) {
              result = T.cast(delegate.get(propertyName));
            }
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.