org.jasig.portlet.emailpreview
Class AccountSummary

java.lang.Object
  extended by org.jasig.portlet.emailpreview.AccountSummary

public final class AccountSummary
extends Object

Encapsulates basic information about the email INBOX. Typicaly sent to the browser via AJAX.

Author:
Andreas Christoforides, Jen Bourey, jbourey@unicon.net, Drew Wills, drew@unicon.net

Constructor Summary
AccountSummary(String inboxUrl, List<EmailMessage> messages, int numUnreadMessages, int numTotalMessages, int messagesStart, int messagesMax, boolean deleteSupported)
           
AccountSummary(Throwable errorCause)
          Indicates the account fetch did not succeed and provides the cause.
 
Method Summary
 Throwable getErrorCause()
           
 String getInboxUrl()
          Provides the URL to the full-featured web-based mail client, if available.
 List<EmailMessage> getMessages()
          Returns a list that contains the emails bound by messagesStart and messagesCode.
 int getMessagesMax()
          Returns the number of messages requested for the Messages list.
 int getMessagesStart()
          Returns the index of the first message in the Messages list.
 int getTotalMessageCount()
          Returns the total number messages in the user's inbox.
 int getUnreadMessageCount()
          Returns the number of unread messages in the user's inbox.
 boolean isDeleteSupported()
           
 boolean isValid()
          Indicates if this object contains valid account details.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccountSummary

public AccountSummary(String inboxUrl,
                      List<EmailMessage> messages,
                      int numUnreadMessages,
                      int numTotalMessages,
                      int messagesStart,
                      int messagesMax,
                      boolean deleteSupported)

AccountSummary

public AccountSummary(Throwable errorCause)
Indicates the account fetch did not succeed and provides the cause. Previously we would communicate this fact by throwing an exception, but we learned that (1) the caching API we use writes these exceptions to Catalina.out, and (2) occurances of MailAuthenticationException are very common, and the logs were being flooded with them.

Parameters:
errorCause -
Method Detail

isValid

public boolean isValid()
Indicates if this object contains valid account details. Otherwise, it will contain an error payload.

Returns:
False if this object represents an error condition instead of an account summary

getErrorCause

public Throwable getErrorCause()

getInboxUrl

public String getInboxUrl()
Provides the URL to the full-featured web-based mail client, if available.

Returns:
A valid web address or null

getUnreadMessageCount

public int getUnreadMessageCount()
Returns the number of unread messages in the user's inbox.

Returns:
The number of unread messages in the user's inbox.

getTotalMessageCount

public int getTotalMessageCount()
Returns the total number messages in the user's inbox.

Returns:
The total number of messages in the user's inbox.

getMessages

public List<EmailMessage> getMessages()
Returns a list that contains the emails bound by messagesStart and messagesCode.

Returns:
A List containing information about emails in the user's inbox

getMessagesStart

public int getMessagesStart()
Returns the index of the first message in the Messages list.

Returns:

getMessagesMax

public int getMessagesMax()
Returns the number of messages requested for the Messages list. The actual size of the list may be lower.

Returns:

isDeleteSupported

public boolean isDeleteSupported()


Copyright © 2012 Jasig. All Rights Reserved.