com.funambol.email.items.manager
Class MessageCreator

java.lang.Object
  extended by com.funambol.email.items.manager.MessageCreator

public class MessageCreator
extends java.lang.Object

This class is used in order to create an email using the list of InternalPart items. this class is an helper for the EntityManagerFilter class


Constructor Summary
MessageCreator()
           
 
Method Summary
static java.lang.String convertHtmlBody(InternalPart v)
          convert an Html Part to Txt Part
static java.lang.String getEncodingType(javax.mail.internet.MimeMessage msg)
          this method checks if message contains non-ASCII characters and set the correct encoding type It's a public method because there is an external unit test
static Ext getExtComplete(java.util.ArrayList ips, int headersDimension)
          create an Ext object with the following info - truncated - body size - all info about attachments
static void getHB_Content(javax.mail.internet.MimeMessage newMsg, javax.mail.Message oldMsg, InternalPart ip)
          get just the InternalPart that contains the body
static InternalPart getHB_GetPart(java.util.ArrayList ips, int numBytes, Ext ext, int headersDimension)
          get just the InternalPart that contains the body
static void getHBA_Content(javax.mail.internet.MimeMessage newMsg, javax.mail.Message oldMsg, java.util.ArrayList ips)
          get just the InternalPart that contains the body
static java.util.ArrayList getHBA_GetParts(java.util.ArrayList ips, Ext ext, int headersDimension)
           
static java.util.ArrayList getHBA_GetParts(java.util.ArrayList ips, int numBytes, Ext ext, int headersDimension)
           
static void setNewContent(javax.mail.Message newMsg, javax.mail.Message oldMsg)
          create an exact copy of the content
static void setNewContent(javax.mail.Message newMsg, javax.mail.Message oldMsg, java.lang.String sign)
          create a copy of the content with the signature Part this method is used in the sending procedure
static java.lang.String[] setNewHeader(javax.mail.Message newMsg, javax.mail.Message oldMsg, boolean isDevice)
          set a new header but keep the old Message-ID for a message that must be downloaded
static void setNewHeader(javax.mail.Message newMsg, javax.mail.Message oldMsg, java.lang.String from, java.lang.String firstname, java.lang.String lastname)
          set a new header but keep the old Message-ID for a message that must be sent
static InternalPart truncBody(InternalPart item, int numBytes, Ext ext, int origSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageCreator

public MessageCreator()
Method Detail

getEncodingType

public static java.lang.String getEncodingType(javax.mail.internet.MimeMessage msg)
                                        throws EntityException
this method checks if message contains non-ASCII characters and set the correct encoding type It's a public method because there is an external unit test

Parameters:
msg - Message
Returns:
encodingType String
Throws:
EntityException

getExtComplete

public static Ext getExtComplete(java.util.ArrayList ips,
                                 int headersDimension)
                          throws EntityException
create an Ext object with the following info - truncated - body size - all info about attachments

Parameters:
ips - part list ArrayList
totalSize - int
Returns:
ext Ext
Throws:
EntityException

getHBA_GetParts

public static java.util.ArrayList getHBA_GetParts(java.util.ArrayList ips,
                                                  int numBytes,
                                                  Ext ext,
                                                  int headersDimension)
                                           throws EntityException
Throws:
EntityException

getHBA_GetParts

public static java.util.ArrayList getHBA_GetParts(java.util.ArrayList ips,
                                                  Ext ext,
                                                  int headersDimension)
                                           throws EntityException
Throws:
EntityException

getHB_Content

public static void getHB_Content(javax.mail.internet.MimeMessage newMsg,
                                 javax.mail.Message oldMsg,
                                 InternalPart ip)
                          throws EntityException
get just the InternalPart that contains the body

Parameters:
newMsg - MimeMessage new Message
oldMsg - Message old Message
ip - InternalPart part of theemail
Throws:
EntityException

getHBA_Content

public static void getHBA_Content(javax.mail.internet.MimeMessage newMsg,
                                  javax.mail.Message oldMsg,
                                  java.util.ArrayList ips)
                           throws EntityException
get just the InternalPart that contains the body

Parameters:
newMsg - MimeMessage new Message
oldMsg - Message old Message
ips - InternalPart part of theemail
Throws:
EntityException

getHB_GetPart

public static InternalPart getHB_GetPart(java.util.ArrayList ips,
                                         int numBytes,
                                         Ext ext,
                                         int headersDimension)
                                  throws EntityException
get just the InternalPart that contains the body

Parameters:
ips - All parts of the emails
numBytes - int
ext - Ext
totalSize - int
Returns:
InternalPart
Throws:
EntityException

truncBody

public static InternalPart truncBody(InternalPart item,
                                     int numBytes,
                                     Ext ext,
                                     int origSize)
                              throws EntityException
Throws:
EntityException

convertHtmlBody

public static java.lang.String convertHtmlBody(InternalPart v)
                                        throws EntityException
convert an Html Part to Txt Part

Parameters:
v - Part
Returns:
part in txt format String
Throws:
EntityException

setNewHeader

public static java.lang.String[] setNewHeader(javax.mail.Message newMsg,
                                              javax.mail.Message oldMsg,
                                              boolean isDevice)
                                       throws EntityException
set a new header but keep the old Message-ID for a message that must be downloaded

Parameters:
newMsg - Message
oldMsg - Message
Returns:
header-id and header dimension
Throws:
EntityException

setNewHeader

public static void setNewHeader(javax.mail.Message newMsg,
                                javax.mail.Message oldMsg,
                                java.lang.String from,
                                java.lang.String firstname,
                                java.lang.String lastname)
                         throws EntityException
set a new header but keep the old Message-ID for a message that must be sent

Parameters:
newMsg - Message
oldMsg - Message
Throws:
EntityException

setNewContent

public static void setNewContent(javax.mail.Message newMsg,
                                 javax.mail.Message oldMsg)
                          throws EntityException
create an exact copy of the content

Parameters:
newMsg - Message
oldMsg - Message
Throws:
EntityException

setNewContent

public static void setNewContent(javax.mail.Message newMsg,
                                 javax.mail.Message oldMsg,
                                 java.lang.String sign)
                          throws java.lang.Exception
create a copy of the content with the signature Part this method is used in the sending procedure

Parameters:
newMsg - Message
oldMsg - Message
sign - String
Throws:
java.lang.Exception


Copyright © 2005-2006 Funambol.