Package org.openntf.domino

Examples of org.openntf.domino.RichTextItem


      return false;
    }

    boolean retval = false;
    Document logDoc = null;
    RichTextItem rtitem = null;
    Database docDb = null;

    try {
      logDoc = db.createDocument();

      logDoc.appendItemValue("Form", _logFormName);

      Throwable ee = getBase();
      if (ee != null) {
        StackTraceElement ste = ee.getStackTrace()[0];
        if (ee instanceof NotesException) {
          logDoc.replaceItemValue("LogErrorNumber", ((NotesException) ee).id);
          logDoc.replaceItemValue("LogErrorMessage", ((NotesException) ee).text);
        } else {
          // Fixed next line
          logDoc.replaceItemValue("LogErrorMessage", getMessage());
        }
        logDoc.replaceItemValue("LogErrorLine", ste.getLineNumber());
        logDoc.replaceItemValue("LogFromMethod", ste.getClassName() + "." + ste.getMethodName());
      }

      if (LogType.TYPE_EVENT.getValue().equals(getEventType())) {
        if (!getSuppressEventStack()) {
          logDoc.replaceItemValue("LogStackTrace", getStackTrace(ee));
        }
      } else {
        logDoc.replaceItemValue("LogStackTrace", getStackTrace(ee));
      }
      logDoc.replaceItemValue("LogSeverity", getSeverity().getName());
      logDoc.replaceItemValue("LogEventTime", getEventTime());
      logDoc.replaceItemValue("LogEventType", getEventType());
      logDoc.replaceItemValue("LogMessage", getMessage());
      logDoc.replaceItemValue("LogFromDatabase", getCurrentDatabase().getFilePath());
      logDoc.replaceItemValue("LogFromServer", getThisServer());
      logDoc.replaceItemValue("LogFromAgent", getThisAgent());
      // Fixed next line
      logDoc.replaceItemValue("LogAgentLanguage", "Java");
      logDoc.replaceItemValue("LogUserName", Factory.getSession().getUserName());
      logDoc.replaceItemValue("LogEffectiveName", Factory.getSession().getEffectiveUserName());
      logDoc.replaceItemValue("LogAccessLevel", getAccessLevel());
      logDoc.replaceItemValue("LogUserRoles", getUserRoles());
      logDoc.replaceItemValue("LogClientVersion", getClientVersion());
      logDoc.replaceItemValue("LogAgentStartTime", getStartTime());

      if (getErrDoc() != null) {
        docDb = getErrDoc().getParentDatabase();
        rtitem = logDoc.createRichTextItem("LogDocInfo");
        rtitem.appendText("The document associated with this event is:");
        rtitem.addNewLine(1);
        rtitem.appendText("Server: " + docDb.getServer());
        rtitem.addNewLine(1);
        rtitem.appendText("Database: " + docDb.getFilePath());
        rtitem.addNewLine(1);
        rtitem.appendText("UNID: " + getErrDoc().getUniversalID());
        rtitem.addNewLine(1);
        rtitem.appendText("Note ID: " + getErrDoc().getNoteID());
        rtitem.addNewLine(1);
        rtitem.appendText("DocLink: ");
        rtitem.appendDocLink(_errDoc, getErrDoc().getUniversalID());
      }

      // make sure Depositor-level users can add documents too
      logDoc.appendItemValue("$PublicAccess", "1");
View Full Code Here


   */
  @Override
  public RichTextItem createRichTextItem(final String name) {
    checkMimeOpen();
    beginEdit();
    RichTextItem ret = null;
    try {
      ret = fromLotus(getDelegate().createRichTextItem(name), RichTextItem.SCHEMA, this);
      markDirty(name, true);
    } catch (NotesException e) {
      DominoUtils.handleException(e, this);
View Full Code Here

  public boolean writeToLog() {
    boolean retval = false;
    try {
      Database db;
      Document logDoc;
      RichTextItem rtitem;
      Database docDb;

      if (!StringUtil.equals(super.getCurrentDatabasePath(), Factory.getSession().getCurrentDatabase().getFilePath())) {
        reinitialiseSettings();
      }

      if (StringUtil.isEmpty(getLogEmail())) {
        db = getLogDb();
      } else {
        db = XSPUtil.getCurrentSessionAsSigner().getDatabase(getThisServer(), "mail.box", false);
      }
      if (db == null) {
        System.out.println("Could not retrieve database at path " + getLogDbName());
        return false;
      }

      logDoc = db.createDocument();
      rtitem = logDoc.createRichTextItem("LogDocInfo");

      logDoc.appendItemValue("Form", super.getLogFormName());

      Throwable ee = getBase();
      String errMsg = "";
      if (null != ee) {
        StackTraceElement ste = ee.getStackTrace()[0];
        if (ee instanceof NotesException) {
          logDoc.replaceItemValue("LogErrorNumber", ((NotesException) ee).id);
          errMsg = ((NotesException) ee).text;
        } else if ("Interpret exception".equals(ee.getMessage()) && ee instanceof com.ibm.jscript.JavaScriptException) {
          com.ibm.jscript.InterpretException ie = (com.ibm.jscript.InterpretException) ee;
          errMsg = "Expression Language Interpret Exception " + ie.getExpressionText();
        } else {
          errMsg = ee.getMessage();
        }

        if (LogType.TYPE_EVENT.getValue().equals(getEventType())) {
          if (!getSuppressEventStack()) {
            logDoc.replaceItemValue("LogStackTrace", getStackTrace(ee));
          }
        } else {
          logDoc.replaceItemValue("LogStackTrace", getStackTrace(ee));
        }
        logDoc.replaceItemValue("LogErrorLine", ste.getLineNumber());
        logDoc.replaceItemValue("LogFromMethod", ste.getClass() + "." + ste.getMethodName());
      }

      if ("".equals(errMsg)) {
        errMsg = getMessage();
      }

      logDoc.replaceItemValue("LogErrorMessage", errMsg);
      logDoc.replaceItemValue("LogEventTime", getEventTime());
      logDoc.replaceItemValue("LogEventType", getEventType());
      // If greater than 32k, put in logDocInfo
      if (getMessage().length() > 32000) {
        rtitem.appendText(getMessage());
        rtitem.addNewLine();
      } else {
        logDoc.replaceItemValue("LogMessage", getMessage());
      }
      logDoc.replaceItemValue("LogSeverity", getSeverity().getName());
      logDoc.replaceItemValue("LogFromDatabase", getCurrentDatabase().getFilePath());
      logDoc.replaceItemValue("LogFromServer", getThisServer());
      logDoc.replaceItemValue("LogFromAgent", getThisAgent());
      logDoc.replaceItemValue("LogAgentLanguage", "Java");
      logDoc.replaceItemValue("LogUserName", Factory.getSession().getUserName());
      logDoc.replaceItemValue("LogEffectiveName", Factory.getSession().getEffectiveUserName());
      logDoc.replaceItemValue("LogAccessLevel", getAccessLevel());
      logDoc.replaceItemValue("LogUserRoles", getUserRoles());
      logDoc.replaceItemValue("LogClientVersion", getClientVersion());
      logDoc.replaceItemValue("LogAgentStartTime", getStartTime());

      if (getErrDoc() != null) {
        docDb = getErrDoc().getParentDatabase();
        rtitem.appendText("The document associated with this event is:");
        rtitem.addNewLine(1);
        rtitem.appendText("Server: " + docDb.getServer());
        rtitem.addNewLine(1);
        rtitem.appendText("Database: " + docDb.getFilePath());
        rtitem.addNewLine(1);
        rtitem.appendText("UNID: " + getErrDoc().getUniversalID());
        rtitem.addNewLine(1);
        rtitem.appendText("Note ID: " + getErrDoc().getNoteID());
        rtitem.addNewLine(1);
        rtitem.appendText("DocLink: ");
        rtitem.appendDocLink(super.getErrDoc(), getErrDoc().getUniversalID());
      }

      // make sure Depositor-level users can add documents too
      logDoc.appendItemValue("$PublicAccess", "1");
View Full Code Here

TOP

Related Classes of org.openntf.domino.RichTextItem

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.