com.openexchange.mail.api
Class MailLogicTools

java.lang.Object
  extended by com.openexchange.mail.api.MailLogicTools

public class MailLogicTools
extends java.lang.Object

MailLogicTools - Provides convenience methods to reply/forward a mail message.

Author:
Thorben Betten

Constructor Summary
MailLogicTools(com.openexchange.session.Session session, int accountId)
          Initializes a new MailLogicTools
 
Method Summary
 MailMessage getFowardMessage(MailMessage[] originalMails)
          Creates a forward message for the messages specified by originalMails.
 MailMessage getFowardMessage(MailMessage[] originalMails, UserSettingMail usm)
          Creates a forward message for the messages specified by originalMails.
 MailMessage getReplyMessage(MailMessage originalMail, boolean replyAll)
          Creates a reply message for the message specified by originalMail.
 MailMessage getReplyMessage(MailMessage originalMail, boolean replyAll, UserSettingMail usm)
          Creates a reply message for the message specified by originalMail.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailLogicTools

public MailLogicTools(com.openexchange.session.Session session,
                      int accountId)
Initializes a new MailLogicTools

Parameters:
session - The session providing user data
accountId - The account ID
Method Detail

getReplyMessage

public MailMessage getReplyMessage(MailMessage originalMail,
                                   boolean replyAll)
                            throws MailException
Creates a reply message for the message specified by originalMail.

If mailing system deals with common RFC822 messages, this convenience method only delegates its request to MimeReply#getReplyMail(MailMessage, boolean, Session) and can be left unchanged. Otherwise an message data specific implementation is needed.

Parameters:
originalMail - The original mail
replyAll - true to reply to all recipients; otherwise false
Returns:
An instance of MailMessage representing the reply message
Throws:
MailException - If reply message cannot be generated

getReplyMessage

public MailMessage getReplyMessage(MailMessage originalMail,
                                   boolean replyAll,
                                   UserSettingMail usm)
                            throws MailException
Creates a reply message for the message specified by originalMail.

If mailing system deals with common RFC822 messages, this convenience method only delegates its request to MimeReply#getReplyMail(MailMessage, boolean, Session) and can be left unchanged. Otherwise an message data specific implementation is needed.

Parameters:
originalMail - The original mail
replyAll - true to reply to all recipients; otherwise false
usm - The user mail settings to use; leave to null to obtain from specified session
Returns:
An instance of MailMessage representing the reply message
Throws:
MailException - If reply message cannot be generated

getFowardMessage

public MailMessage getFowardMessage(MailMessage[] originalMails)
                             throws MailException
Creates a forward message for the messages specified by originalMails. If multiple messages are specified then these messages are forwarded as attachment since no inline forward is possible.

If mailing system deals with common RFC822 messages, this convenience method only delegates its request to MimeForward#getFowardMail(MailMessage[], Session) and can be left unchanged. Otherwise a message data specific implementation is needed.

Parameters:
originalMails - The original mails
Returns:
An instance of MailMessage representing the forward message
Throws:
MailException - If forward message cannot be generated

getFowardMessage

public MailMessage getFowardMessage(MailMessage[] originalMails,
                                    UserSettingMail usm)
                             throws MailException
Creates a forward message for the messages specified by originalMails. If multiple messages are specified then these messages are forwarded as attachment since no inline forward is possible.

If mailing system deals with common RFC822 messages, this convenience method only delegates its request to MimeForward#getFowardMail(MailMessage[], Session) and can be left unchanged. Otherwise a message data specific implementation is needed.

Parameters:
originalMails - The original mails
usm - The user mail settings to use; leave to null to obtain from specified session
Returns:
An instance of MailMessage representing the forward message
Throws:
MailException - If forward message cannot be generated