org.jasig.portlet.emailpreview.dao.impl
Class EmailAccountDaoImpl

java.lang.Object
  extended by org.jasig.portlet.emailpreview.dao.impl.EmailAccountDaoImpl
All Implemented Interfaces:
IEmailAccountDao, InitializingBean, ApplicationContextAware

@Component
public class EmailAccountDaoImpl
extends Object
implements IEmailAccountDao, InitializingBean, ApplicationContextAware

A Data Access Object (DAO) for retrieving email account information. Currently all the information retrieved is related to the user's inbox.

Version:
$Revision: 20571 $
Author:
Andreas Christoforides

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
EmailAccountDaoImpl()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  EmailMessageContent getContentString(Object content, String mimeType)
           
protected  List<EmailMessage> getEmailMessages(Folder mailFolder, int pageStart, int messageCount)
           
protected  int getTotalEmailMessageCount(Folder inbox)
          Get the total number of email messages in the supplied folder.
protected  int getUnreadEmailMessageCount(Folder inbox)
          Get the total number of unread email messages in the supplied folder.
protected  boolean isHtml(String mimeType)
          Determine if the supplied MIME type represents HTML content.
 AccountInfo retrieveEmailAccountInfo(MailStoreConfiguration storeConfig, Authenticator auth, int start, int messageCount)
          Retrieve a list of recent email from the mail store, as well as a summary of the email account's current state.
 EmailMessage retrieveMessage(MailStoreConfiguration storeConfig, Authenticator auth, int messageNum)
          Retrieve an individual message from the mail store.
 void setApplicationContext(ApplicationContext ctx)
           
 void setSecurityFile(String path)
          Set the file path to the Anti-samy policy file to be used for cleaning strings.
protected  EmailMessage wrapMessage(Message currentMessage, boolean populateContent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

EmailAccountDaoImpl

public EmailAccountDaoImpl()
Method Detail

setApplicationContext

public void setApplicationContext(ApplicationContext ctx)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

setSecurityFile

public void setSecurityFile(String path)
Set the file path to the Anti-samy policy file to be used for cleaning strings.

Parameters:
path -

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

retrieveEmailAccountInfo

public AccountInfo retrieveEmailAccountInfo(MailStoreConfiguration storeConfig,
                                            Authenticator auth,
                                            int start,
                                            int messageCount)
                                     throws EmailPreviewException
Description copied from interface: IEmailAccountDao
Retrieve a list of recent email from the mail store, as well as a summary of the email account's current state.

Specified by:
retrieveEmailAccountInfo in interface IEmailAccountDao
Returns:
Throws:
EmailPreviewException

getEmailMessages

protected List<EmailMessage> getEmailMessages(Folder mailFolder,
                                              int pageStart,
                                              int messageCount)
                                       throws MessagingException,
                                              IOException,
                                              org.owasp.validator.html.ScanException,
                                              org.owasp.validator.html.PolicyException
Throws:
MessagingException
IOException
org.owasp.validator.html.ScanException
org.owasp.validator.html.PolicyException

retrieveMessage

public EmailMessage retrieveMessage(MailStoreConfiguration storeConfig,
                                    Authenticator auth,
                                    int messageNum)
Description copied from interface: IEmailAccountDao
Retrieve an individual message from the mail store.

Specified by:
retrieveMessage in interface IEmailAccountDao
Returns:

wrapMessage

protected EmailMessage wrapMessage(Message currentMessage,
                                   boolean populateContent)
                            throws MessagingException,
                                   IOException,
                                   org.owasp.validator.html.ScanException,
                                   org.owasp.validator.html.PolicyException
Throws:
MessagingException
IOException
org.owasp.validator.html.ScanException
org.owasp.validator.html.PolicyException

getContentString

protected EmailMessageContent getContentString(Object content,
                                               String mimeType)
                                        throws IOException,
                                               MessagingException
Throws:
IOException
MessagingException

isHtml

protected boolean isHtml(String mimeType)
Determine if the supplied MIME type represents HTML content. This implementation assumes that the inclusion of the string "text/html" in a mime-type indicates HTML content.

Parameters:
mimeType -
Returns:

getTotalEmailMessageCount

protected int getTotalEmailMessageCount(Folder inbox)
                                 throws MessagingException
Get the total number of email messages in the supplied folder.

Parameters:
inbox -
Returns:
Throws:
MessagingException

getUnreadEmailMessageCount

protected int getUnreadEmailMessageCount(Folder inbox)
                                  throws MessagingException
Get the total number of unread email messages in the supplied folder.

Parameters:
inbox -
Returns:
Throws:
MessagingException


Copyright © 2010 Jasig. All Rights Reserved.