Package org.openntf.domino

Examples of org.openntf.domino.EmbeddedObject


  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[]>();
        while (entry != null) {
          String name = entry.getName();
View Full Code Here


  public void addAttachments(final MIMEEntity parent) {
    try {
      Stream streamFile = null;
      for (IEmailAttachment attach : getAttachments()) {
        InputStream is = null;
        EmbeddedObject eo = null;

        String fileName = attach.getFileName();
        // Get content type
        String contentType = URLConnection.guessContentTypeFromName(fileName);
        if (null == contentType) {
          contentType = "application/octet-stream";
        }
        int idex = StringUtil.indexOfIgnoreCase(fileName, ".", fileName.length() - 6);
        if (idex > -1) {
          String extension = fileName.substring(idex);
          if (StringUtil.equals("gif", extension)) {
            contentType = "image/gif";
          } else if (StringUtil.equals("jpg", extension) || StringUtil.equals("jpeg", extension)) {
            contentType = "image/jpeg";
          } else if (StringUtil.equals("png", extension)) {
            contentType = "image/png";
          }
        }
        contentType += "; name=\"" + fileName + "\"";

        try {
          Type attachmentType = attach.getAttachmentType();
          if (attachmentType == Type.DOCUMENT) {
            //retrieve the document containing the attachment to send from the relevant
            Database dbFile = getSession().getDatabase(getSession().getServerName(), attach.getDbPath());
            Document docFile = dbFile.getDocumentByUNID(attach.getUnid());
            if (null != docFile) {
              eo = docFile.getAttachment(attach.getFileName());
              is = eo.getInputStream();
            }
          } else if (attachmentType == Type.FILE) {
            is = new FileInputStream(attach.getPath() + attach.getFileName());
          } else if (attachmentType == Type.STREAM) {
            is = attach.getInputStream();
View Full Code Here

TOP

Related Classes of org.openntf.domino.EmbeddedObject

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.