Compoze Software, Inc.

com.compoze.mail
Interface IFolder


public interface IFolder

This interface defines a folder. A folder can hold messages, sub-folders or both.


Field Summary
static int TYPE_DELETED
          This represents the 'Deleted' or 'Trash' folder type.
static int TYPE_DRAFTS
          This represents the 'Drafts' folder type.
static int TYPE_INBOX
          This represents the 'Inbox' folder type.
static int TYPE_OTHER
          This represents the 'Other' folder type.
static int TYPE_SENT
          This represents the 'Sent' folder type.
 
Method Summary
 IFolder copy(IFolder targetFolder)
          Copys this folder (including all messages) to the specified target parent folder.
 IFolder createFolder(java.lang.String sName)
          Creates a sub-folder with the specified name directly under this folder.
 void delete()
          Deletes this folder.
 java.lang.String getFullName()
          Gets the full name of this folder.
 java.lang.Object getID()
          Gets the ID of this folder.
 IMessage getMessage(java.lang.Object id)
          Gets the message with the specified ID from this folder.
 IMessage getMessage(java.lang.Object id, boolean bMarkRead)
          Gets the message with the specified ID from this folder.
 int getMessageCount()
          Gets the total message count for this folder.
 int getMessageCount(MessageFilter filter)
          Gets the message count for this folder.
 java.util.List getMessages()
          Gets a list of all messages in this folder
 java.util.List getMessages(int iFromIndex, int iToIndex)
          Gets the sublist of messages between the specified iFromIndex and iToIndex.
 java.util.List getMessages(int iFromIndex, int iToIndex, MessageFilter filter)
          Gets the sublist of messages between the specified iFromIndex and iToIndex.
 java.util.List getMessages(int iFromIndex, int iToIndex, MessageFilter filter, MessageComparator comp)
          Gets the sublist of messages between the specified iFromIndex and iToIndex.
 java.lang.String getName()
          Gets the name of this folder.
 IFolder getParent()
          Gets the parent folder of this folder.
 int getSubFolderCount()
          Gets the number of sub-folders under this folder.
 java.util.List getSubFolders()
          Gets the sub-folders under this folder.
 int getType()
          Gets the type of this folder.
 int getUnreadMessageCount()
          Gets the total unread message count for this folder.
 boolean hasSubFolders()
          Checks if this folder has sub-folders.
 boolean isUnderDeletedFolder()
          Checks if this folder is under the 'deleted' folder.
 void move(IFolder targetFolder)
          Moves this folder under the specified target folder.
 void refresh()
          Refreshes the cached content of this folder.
 void rename(java.lang.String sName)
          Renames this folder to the specified name.
 

Field Detail

TYPE_INBOX


public static final int TYPE_INBOX
This represents the 'Inbox' folder type.

TYPE_DELETED


public static final int TYPE_DELETED
This represents the 'Deleted' or 'Trash' folder type.

TYPE_DRAFTS


public static final int TYPE_DRAFTS
This represents the 'Drafts' folder type.

TYPE_SENT


public static final int TYPE_SENT
This represents the 'Sent' folder type.

TYPE_OTHER


public static final int TYPE_OTHER
This represents the 'Other' folder type.
Method Detail

refresh


public void refresh()
             throws MailException
Refreshes the cached content of this folder. Cached content includes number of messages, unread message count and number (and existence) of sub-folders.

getParent


public IFolder getParent()
                  throws MailException
Gets the parent folder of this folder.
Returns:
the parent folder of this folder or null if has no parent

getSubFolders


public java.util.List getSubFolders()
                             throws MailException
Gets the sub-folders under this folder. If you are interested in checking for the existence of sub-folders, use getSubFolderCount() or hasSubFolders().
Returns:
a list of IFolder objects

getSubFolderCount


public int getSubFolderCount()
                      throws MailException
Gets the number of sub-folders under this folder.
Returns:
the number of folders or -1 if not available
See Also:
getSubFolders()

hasSubFolders


public boolean hasSubFolders()
                      throws MailException
Checks if this folder has sub-folders.
Returns:
true if this folder has sub-folders; false otherwise
See Also:
getSubFolders()

getName


public java.lang.String getName()
                         throws MailException
Gets the name of this folder.
Returns:
the name of this folder

getFullName


public java.lang.String getFullName()
                             throws MailException
Gets the full name of this folder.
Returns:
the full name of this folder

getMessageCount


public int getMessageCount()
                    throws MailException
Gets the total message count for this folder.
Returns:
the total number of messages or -1 if count is unavailable

getMessageCount


public int getMessageCount(MessageFilter filter)
                    throws MailException
Gets the message count for this folder.
Returns:
the number of messages or -1 if count is unavailable

getUnreadMessageCount


public int getUnreadMessageCount()
                          throws MailException
Gets the total unread message count for this folder.
Returns:
the total number of unread messages or -1 if count is unavailable

delete


public void delete()
            throws MailException
Deletes this folder. All messages and sub-folders are deleted.
Throws:
MailException - an error occurs when deleting the folder

rename


public void rename(java.lang.String sName)
            throws MailException
Renames this folder to the specified name.
Parameters:
sName - the new name of the folder (may not be null or empty)

getID


public java.lang.Object getID()
                       throws MailException
Gets the ID of this folder.
Returns:
the ID of this folder

getType


public int getType()
            throws MailException
Gets the type of this folder.
Returns:
the type of this folder (see TYPE_ constants)

isUnderDeletedFolder


public boolean isUnderDeletedFolder()
                             throws MailException
Checks if this folder is under the 'deleted' folder.
Returns:
true if this folder is under the deleted folder; false otherwise

getMessages


public java.util.List getMessages()
                           throws MailException
Gets a list of all messages in this folder
Returns:
a list of IMessage objects

getMessages


public java.util.List getMessages(int iFromIndex,
                                  int iToIndex)
                           throws MailException
Gets the sublist of messages between the specified iFromIndex and iToIndex.
Parameters:
iFromIndex - the from index endpoint (inclusive)
iToIndex - the to index highpoint (exclusive)
Returns:
a list of IMessage objects

getMessages


public java.util.List getMessages(int iFromIndex,
                                  int iToIndex,
                                  MessageFilter filter)
                           throws MailException
Gets the sublist of messages between the specified iFromIndex and iToIndex.
Parameters:
iFromIndex - the from index endpoint (inclusive)
iToIndex - the to index highpoint (exclusive)
filter - the filter
Returns:
a list of IMessage objects

getMessages


public java.util.List getMessages(int iFromIndex,
                                  int iToIndex,
                                  MessageFilter filter,
                                  MessageComparator comp)
                           throws MailException
Gets the sublist of messages between the specified iFromIndex and iToIndex.
Parameters:
iFromIndex - the from index endpoint (inclusive)
iToIndex - the to index highpoint (exclusive)
filter - the filter
comp - the message comparator for sorting (null for default sorting)
Returns:
a list of IMessage objects

createFolder


public IFolder createFolder(java.lang.String sName)
                     throws MailException
Creates a sub-folder with the specified name directly under this folder.
Parameters:
sName - the name of the folder (may not be null or empty)
Returns:
the newly created folder or null if the create fails

getMessage


public IMessage getMessage(java.lang.Object id)
                    throws MailException
Gets the message with the specified ID from this folder.
Parameters:
id - the ID of the message to retrieve
Returns:
the message with the specified ID or null if not found

getMessage


public IMessage getMessage(java.lang.Object id,
                           boolean bMarkRead)
                    throws MailException
Gets the message with the specified ID from this folder.
Parameters:
id - the ID of the message to retrieve
bMarkRead - true to mark the message as read; false otherwise
Returns:
the message with the specified ID or null if not found

move


public void move(IFolder targetFolder)
          throws MailException
Moves this folder under the specified target folder.
Parameters:
targetFolder - the target folder to move to (may not be null)

copy


public IFolder copy(IFolder targetFolder)
             throws MailException
Copys this folder (including all messages) to the specified target parent folder.
Parameters:
f - the target parent folder to copy to (may not be null)
Returns:
the resulting folder

Compoze Software, Inc.

Copyright ©1999-2001 Compoze Software, Inc. All rights reserved.