Package lotus.domino

Examples of lotus.domino.Document


  }
  protected Document loadOptionsDocument() {
    try {
      Database db = ExtLibUtil.getCurrentDatabase();
      View v = db.getView("GlobalOptions");
      Document doc = v.getFirstDocument();
      return doc;
    } catch(Exception ex) {
      ex.printStackTrace();
    }
    return null;
View Full Code Here


          if(db==null) {
            // Should use the log application
            throw new MimeEmailException("Unbale to find an NSF to send the email message");
          }
      lotus.domino.Session session = db.getParent();
      Document doc = db.createDocument();

      doc.appendItemValue("Form", "Memo"); //$NON-NLS-1$

      doc.appendItemValue("Subject", getSubject()); //$NON-NLS-1$
      doc.appendItemValue("SendTo", getCommaSeparatedTo()); //$NON-NLS-1$
      doc.appendItemValue("CopyTo", getCommaSeparatedCC()); //$NON-NLS-1$
      doc.appendItemValue("BlindCopyTo", getCommaSeparatedTo()); //$NON-NLS-1$

      boolean convertMime = session.isConvertMime();
      session.setConvertMIME(false);
      try {
 
        MIMEEntity topRelated = doc.createMIMEEntity("Body"); //$NON-NLS-1$
 
        // Set up the multipart header
        MIMEHeader header = topRelated.createHeader("Content-Type"); //$NON-NLS-1$
 
        // EE needs to use multipart/alternative or the email clients will
        // turn the content into an attachment.
        header.setHeaderVal("multipart/related");
 
        MIMEEntity topAlternative = topRelated.createChildEntity();
 
        // Set up the multipart header
        header = topAlternative.createHeader("Content-Type");
 
        // EE needs to use multipart/alternative or the email clients will
        // turn the content into an attachment.
        header.setHeaderVal("multipart/alternative");
 
        try {
          for(MimePart part : getMimeParts()) {
            MIMEEntity mime = topAlternative.createChildEntity();
            try {
              lotus.domino.Stream stream = session.createStream();
              try {
                String mimeType = part.getMimeType();
                String content = part.getContent();
                stream.writeText(content);
                mime.setContentFromText(stream, mimeType, 0);
                if(StringUtil.equals(mimeType, "text/plain")) {
                  mime.encodeContent(MIMEEntity.ENC_QUOTED_PRINTABLE);
                } else {
                        mime.encodeContent(MIMEEntity.ENC_BASE64);
                }
              } finally {
                stream.close();
                stream.recycle();
              }
            } finally {
              mime.recycle();
            }
                }
 
         
 
  // USING JAVA MAIL       
  //              MimeMultipart mmp = new MimeMultipart("alternative");
  //              MimeBodyPart bodyPart;
  //              for(MimePart part : getMimeParts()) {
  //                  bodyPart = new MimeBodyPart();
  //                  bodyPart.setContent(part.getContent(), part.getMimeType());
  //                  Map<String, String> headers = part.getHeaders();
  //                  Set<String> keys = headers.keySet();
  //                  for(String key : keys) {
  //                      bodyPart.addHeader(key, headers.get(key));
  //                  }
  //                  mmp.addBodyPart(bodyPart);
  //              }
  //              msg.setContent(mmp);
         
          // format of email message in regards to various parts
          // multipart/related
          // multipart/alternative
          // plain text
          // embedded experience (json or xml)
          // html
 
  // USING NOTES API       
  //        Iterator<MimeBodyPartWrapper> keyItr = mimePartList.iterator();
  //
  //        MimeBodyPart mimePart;
  //        MimeBodyPartWrapper mimePartWrapper;
  //        MIMEEntity mime;
  //        lotus.domino.Stream stream;
  //        while (keyItr.hasNext()) {
  //          mimePartWrapper = keyItr.next();
  //          mimePart = mimePartWrapper.getMimeBodyPart();
  //          // mimePart.setHeader("Content-transfer-encoding",
  //          // encodingType);
  //          mime = topAlternative.createChildEntity();
  //          // header = mime.createHeader("Content-transfer-encoding");
  //          // header.setHeaderVal(encodingType);
  //          stream = session.createStream();
  //          stream.writeText((String) mimePart.getContent());
  //
  //          // mime.setContentFromText(stream,
  //          // mimePart.getContentType(), 0);
  //          // String cType="text/plain";
  //          if (TEXT_PLAIN.equalsIgnoreCase(mimePartWrapper.getContentType())) {
  ////            System.out.println("here plain text");
  //            mime.setContentFromText(stream, TEXT_PLAIN, 0);
  //            mime.encodeContent(MIMEEntity.ENC_QUOTED_PRINTABLE);
  //          } else if (EMBED_JSON.equalsIgnoreCase(mimePartWrapper.getContentType())) {
  ////            System.out.println("here ee json");
  //            mime.setContentFromText(stream, EMBED_JSON, 0);
  ////            System.out.println("ee json encoding: "
  ////                + mime.getEncoding()
  ////                + ", MIMEEntity.ENC_BASE64: "
  ////                + MIMEEntity.ENC_BASE64);
  //            mime.encodeContent(MIMEEntity.ENC_BASE64);
  //          } else if (EMBED_XML.equalsIgnoreCase(mimePartWrapper.getContentType())) {
  //            mime.setContentFromText(stream, EMBED_XML, 0);
  //            mime.encodeContent(MIMEEntity.ENC_BASE64);
  //          } else if (TEXT_HTML.equalsIgnoreCase(mimePartWrapper.getContentType())) {
  ////            System.out.println("here html");
  //            mime.setContentFromText(stream, TEXT_HTML, 0);
  //            mime.encodeContent(MIMEEntity.ENC_QUOTED_PRINTABLE);
  //          }
  //
  //          stream.close();
  //          stream.recycle();
  //          mime.recycle();
  //        }
        } catch (Exception e) {
          // TODO: Add Logging!
          e.printStackTrace();
        }
 
        // Must happen after setting all of the mime content
        String from = null; //getFrom();
        if (StringUtil.isNotEmpty(from)) {
          doc.appendItemValue("Principal", from);
          doc.appendItemValue("iNetFrom", from);
          doc.appendItemValue("$iNetPrincipal", from);
        }
 
        doc.send(false);
        doc.recycle();
 
        // Set mime conversion back to what it was originally
      } finally {
        session.setConvertMIME(convertMime);
      }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public NotesDocument getDocument() throws NotesConnectorExceptionImpl {
    try {
      Document doc = getNotesObject().getDocument();
      if (doc == null) {
        return null;
      }
      return new NotesDocumentImpl(doc);
    } catch (NotesException e) {
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public NotesDocument getFirstDocument() throws NotesConnectorExceptionImpl {
    try {
      Document doc = getNotesObject().getFirstDocument();
      if (doc == null) {
        return null;
      }
      return new NotesDocumentImpl(doc);
    } catch (NotesException e) {
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public NotesDocument getNextDocument() throws NotesConnectorExceptionImpl {
    try {
      Document doc = getNotesObject().getNextDocument();
      if (doc == null) {
        return null;
      }
      return new NotesDocumentImpl(doc);
    } catch (NotesException e) {
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public NotesDocument getNextDocument(NotesDocument document)
      throws NotesConnectorExceptionImpl {
    try {
      Document doc = getNotesObject().getNextDocument(
          ((NotesDocumentImpl) document).getNotesObject());
      if (doc == null) {
        return null;
      }
      return new NotesDocumentImpl(doc);
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public NotesDocument getFirstDocument()
      throws NotesConnectorExceptionImpl {
    try {
      Document doc = getNotesObject().getFirstDocument();
      if (doc == null) {
        return null;
      }
      return new NotesDocumentImpl(doc);
    } catch (NotesException e) {
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public NotesDocument getNextDocument(NotesDocument previousDocument)
      throws NotesConnectorExceptionImpl {
    try {
      Document doc = getNotesObject().getNextDocument(
          ((NotesDocumentImpl) previousDocument).getNotesObject());
    if (doc == null) {
      return null;
    }
    return new NotesDocumentImpl(doc);
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public NotesDocument getDocumentByKey(Object key)
      throws NotesConnectorExceptionImpl {
    try {
      Document doc = getNotesObject().getDocumentByKey(key);
      if (doc == null) {
        return null;
      }
      return new NotesDocumentImpl(doc);
    } catch (NotesException e) {
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public NotesDocument getDocumentByKey(Vector key)
      throws NotesConnectorExceptionImpl {
    try {
      Document doc = getNotesObject().getDocumentByKey(
          (Vector) TypeConverter.toNotesItemValue(key));
      if (doc == null) {
        return null;
      }
      return new NotesDocumentImpl(doc);
View Full Code Here

TOP

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