public class MailFolder
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
MailFolder - a data container object for a mail folder| Modifier and Type | Class and Description |
|---|---|
static class |
MailFolder.DefaultFolderType
The default folder type.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_FOLDER_ID
Virtual full name of mailbox's root folder
|
static java.lang.String |
DEFAULT_FOLDER_NAME
Virtual name of mailbox's root folder
|
| Constructor and Description |
|---|
MailFolder()
Initializes a new
MailFolder |
| Modifier and Type | Method and Description |
|---|---|
void |
addPermission(MailPermission permission)
Adds a permission.
|
void |
addPermissions(java.util.Collection<? extends MailPermission> permissions)
Adds a collection of permissions.
|
void |
addPermissions(MailPermission[] permissions)
Adds an array of permissions.
|
MailFolder |
clone() |
boolean |
containsDefaultFolder()
Checks if default-folder flag was set through
setDefaultFolder(boolean). |
boolean |
containsDefaultFolderType()
Checks if default folder type was set through
setDefaultFolderType(DefaultFolderType). |
boolean |
containsDeletedMessageCount()
Checks if the number of messages was set through
setDeletedMessageCount(int). |
boolean |
containsExists()
Checks if folder existence status was set through
setExists(boolean). |
boolean |
containsFullname()
Checks if full name is set through
setFullname(String). |
boolean |
containsHoldsFolders()
Checks if the holds-folder flag was set through
setHoldsFolders(boolean). |
boolean |
containsHoldsMessages()
Checks if he holds-messages flag was set through
setHoldsMessages(boolean). |
boolean |
containsMessageCount()
Checks if number of messages was set through
setMessageCount(int). |
boolean |
containsName()
Checks if name was set through
setName(String). |
boolean |
containsNewMessageCount()
Checks if the number of new messages was set through
setNewMessageCount(int). |
boolean |
containsOwner()
Checks if the owner was set.
|
boolean |
containsOwnPermission()
Checks if own permission was set through
setOwnPermission(MailPermission). |
boolean |
containsParentFullname()
Checks if parent fullname was set through
setParentFullname(String). |
boolean |
containsPermissions()
Checks if permissions were set through
addPermission(MailPermission), addPermissions(Collection), or
addPermissions(MailPermission[]). |
boolean |
containsProperty(java.lang.String name)
Checks presence of named property.
|
boolean |
containsPublic()
Checks if the public flag was set.
|
boolean |
containsRootFolder()
Checks if root-folder flag was set through
setRootFolder(boolean). |
boolean |
containsSeparator()
Checks if seperator character was set through
setSeparator(char). |
boolean |
containsShared()
Checks if the shared flag was set.
|
boolean |
containsSubfolders()
Checks if has-subfolders flag was set through
setSubfolders(boolean). |
boolean |
containsSubscribed()
Checks if subscribed status was set through
setSubscribed(boolean). |
boolean |
containsSubscribedSubfolders()
Checks if the has-subscribed-subfolders flag was set through
setSubscribedSubfolders(boolean). |
boolean |
containsSupportsUserFlags()
Checks if the supports-user-flags flag was set through
setSupportsUserFlags(boolean). |
boolean |
containsUnreadMessageCount()
Checks if the number of unread messages was set through
setUnreadMessageCount(int). |
boolean |
exists()
Checks if this folder exists.
|
MailFolder.DefaultFolderType |
getDefaultFolderType()
Gets the default folder type.
|
int |
getDeletedMessageCount()
Gets the number of messages marked for deletion in this folder
|
java.lang.String |
getFullname()
Gets the full name.
|
int |
getMessageCount()
Gets the number of messages.
|
java.lang.String |
getName()
Gets the name.
|
int |
getNewMessageCount()
Gets the number of new messages (since last time this folder was accessed).
|
java.lang.String |
getOwner()
Gets the shared owner or
null. |
MailPermission |
getOwnPermission()
Gets the permission for currently logged-in user accessing this folder
The returned permission should reflect user's permission regardless if mailing system supports permissions or not.
|
java.lang.String |
getParentFullname()
Gets the parent fullname.
|
MailPermission[] |
getPermissions() |
java.lang.Object |
getProperty(java.lang.String name)
Gets specified property.
|
char |
getSeparator()
Gets the separator character.
|
int |
getUnreadMessageCount()
Gets the number of unread messages.
|
boolean |
hasSubfolders()
Checks if this mail folder has subfolders.
|
boolean |
hasSubscribedSubfolders()
Checks if this mail folder has subscribed subfolders.
|
boolean |
isConfirmedHam()
Checks if this mail folder denotes the CONFIRMED_HAM folder.
|
boolean |
isConfirmedSpam()
Checks if this mail folder denotes the CONFIRMED_SPAM folder.
|
boolean |
isDefaultFolder()
Checks if this folder denotes a default folder (Drafts, Sent, Trash, etc.)
|
boolean |
isDrafts()
Checks if this mail folder denotes the DRAFTS folder.
|
boolean |
isHoldsFolders()
Checks if this folder is able to hold folders.
|
boolean |
isHoldsMessages()
Checks if this folder is able to hold messages.
|
boolean |
isInbox()
Checks if this mail folder denotes the INBOX folder.
|
boolean |
isPublic()
Checks if this folder is public.
|
boolean |
isRootFolder()
Checks if this folder denotes the root folder
|
boolean |
isSent()
Checks if this mail folder denotes the SENT folder.
|
boolean |
isShared()
Checks if this folder is shared.
|
boolean |
isSpam()
Checks if this mail folder denotes the SPAM folder.
|
boolean |
isSubscribed()
Returns whether the denoted mail folder is subscribed or not.
|
boolean |
isSupportsUserFlags()
Checks if this folder supports user flags.
|
boolean |
isTrash()
Checks if this mail folder denotes the TRASH folder.
|
boolean |
liveAccess()
Signals if mail folder is accessed in a on-the-fly fashion or if there is any kind of caching mechanism.
|
void |
removeDefaultFolder()
Removes the default folder flag.
|
void |
removeDefaultFolderType()
Removes the default folder type.
|
void |
removeDeletedMessageCount()
Removes the number of messages marked for deletion in this folder.
|
void |
removeExists()
Removes exists status.
|
void |
removeFullname()
Removes the full name.
|
void |
removeHoldsFolders()
Removes the holds-folders flag
|
void |
removeHoldsMessages()
Removes the holds-messages flag
|
void |
removeMessageCount()
Removes the message-count.
|
void |
removeName()
Removes the name.
|
void |
removeNewMessageCount()
Removes the new-message-count.
|
void |
removeOwne()
Removes the owner.
|
void |
removeOwnPermission()
Removes the own permission.
|
void |
removeParentFullname()
Removes the parent fullname.
|
void |
removePermissions()
Removes the permissions.
|
void |
removePublic()
Removes the public flag.
|
void |
removeRootFolder()
Removes the root folder flag.
|
void |
removeSeparator()
Removes the separator character.
|
void |
removeShared()
Removes the shared flag.
|
void |
removeSubfolders()
Removes the has-subfolders flag.
|
void |
removeSubscribed()
Removes the subscription status.
|
void |
removeSubscribedSubfolders()
Removes has-subscribed-subfolders flag.
|
void |
removeSupportsUserFlags()
Removes the supports-user-flags flag.
|
void |
removeUnreadMessageCount()
Removes the unread-message-count.
|
void |
setDefaultFolder(boolean defaultFolder)
Sets the default folder flag.
|
void |
setDefaultFolderType(MailFolder.DefaultFolderType defaulFolderType)
Sets default folder type.
|
void |
setDeletedMessageCount(int deletedMessageCount)
Sets the number of messages marked for deletion in this folder.
|
void |
setExists(boolean exists)
Sets the exists status.
|
void |
setFullname(java.lang.String fullname)
Sets this mail folder's full name.
|
void |
setHoldsFolders(boolean holdsFolders)
Sets if this folder holds folders.
|
void |
setHoldsMessages(boolean holdsMessages)
Sets if this folder holds messages.
|
void |
setLiveAccess(boolean liveAccess)
Sets the live-access flag.
|
void |
setMessageCount(int messageCount)
Sets the number of messages.
|
void |
setName(java.lang.String name)
Sets this mail folder's name.
|
void |
setNewMessageCount(int newMessageCount)
Sets the number of new messages.
|
void |
setOwner(java.lang.String owner)
Sets the shared owner or
null. |
void |
setOwnPermission(MailPermission ownPermission)
Sets own permission.
|
void |
setParentFullname(java.lang.String parentFullname)
Sets the parent fullname.
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets given property
If value is
null, a remove is performed. |
java.lang.Object |
setPropertyIfAbsent(java.lang.String name,
java.lang.Object value)
Sets the property if absent.
|
void |
setPublic(boolean isPublic)
Sets the public flag.
|
void |
setRootFolder(boolean rootFolder)
Sets the root folder flag.
|
void |
setSeparator(char separator)
Sets the separator character.
|
void |
setShared(boolean shared)
Sets the shared flag.
|
void |
setSubfolders(boolean hasSubfolders)
Sets if this mail folder has subfolders.
|
void |
setSubscribed(boolean subscribed)
Sets the subscription status for this mail folder.
|
void |
setSubscribedSubfolders(boolean hasSubscribedSubfolders)
Sets if this mail folder has subscribed subfolders.
|
void |
setSupportsUserFlags(boolean supportsUserFlags)
Sets the supports-user-flags flag.
|
void |
setUnreadMessageCount(int unreadMessageCount)
Sets the number of unread messages.
|
java.lang.String |
toString() |
public static final java.lang.String DEFAULT_FOLDER_NAME
public static final java.lang.String DEFAULT_FOLDER_ID
public MailFolder()
MailFolderpublic void setLiveAccess(boolean liveAccess)
liveAccess - The flag to setpublic boolean liveAccess()
Default is true.
true for on-the-fly access; otherwise falsepublic boolean containsProperty(java.lang.String name)
name - The nametrue if present; otherwise falsepublic java.lang.Object getProperty(java.lang.String name)
name - The namenullpublic void setProperty(java.lang.String name,
java.lang.Object value)
If value is null, a remove is performed.
name - The namevalue - The valuepublic java.lang.Object setPropertyIfAbsent(java.lang.String name,
java.lang.Object value)
name - The namevalue - The valuenull for successful insertionpublic MailFolder clone()
clone in class java.lang.Objectpublic java.lang.String getFullname()
DEFAULT_FOLDER_ID if this mail folder denotes the root folder)public boolean containsFullname()
setFullname(String).true if full name is set; otherwise falsepublic void removeFullname()
public void setFullname(java.lang.String fullname)
If this mail folder denotes the root folder, DEFAULT_FOLDER_ID is supposed to be set as fullname.
fullname - the full name to setpublic boolean hasSubfolders()
true if this mail folder has subfolders; otherwise falsepublic boolean containsSubfolders()
setSubfolders(boolean).true if has-subfolders flag is set; otherwise falsepublic void removeSubfolders()
public void setSubfolders(boolean hasSubfolders)
hasSubfolders - the has-subfolders flag to setpublic boolean hasSubscribedSubfolders()
true if this mail folder has subscribed subfolders; otherwise falsepublic boolean containsSubscribedSubfolders()
setSubscribedSubfolders(boolean).true if the has-subscribed-subfolders flag was set; otherwise falsepublic void removeSubscribedSubfolders()
public void setSubscribedSubfolders(boolean hasSubscribedSubfolders)
hasSubscribedSubfolders - the has-subscribed-subfolders flag to setpublic MailFolder.DefaultFolderType getDefaultFolderType()
public boolean isInbox()
true if this mail folder denotes the INBOX folder; otherwise falsepublic boolean isDrafts()
true if this mail folder denotes the DRAFTS folder; otherwise falsepublic boolean isSent()
true if this mail folder denotes the SENT folder; otherwise falsepublic boolean isSpam()
true if this mail folder denotes the SPAM folder; otherwise falsepublic boolean isTrash()
true if this mail folder denotes the TRASH folder; otherwise falsepublic boolean isConfirmedSpam()
true if this mail folder denotes the CONFIRMED_SPAM folder; otherwise falsepublic boolean isConfirmedHam()
true if this mail folder denotes the CONFIRMED_HAM folder; otherwise falsepublic boolean containsDefaultFolderType()
setDefaultFolderType(DefaultFolderType).true if default folder type is set; otherwise falsepublic void removeDefaultFolderType()
public void setDefaultFolderType(MailFolder.DefaultFolderType defaulFolderType)
name - the name to setpublic java.lang.String getName()
public boolean containsName()
setName(String).true if name is set; otherwise falsepublic void removeName()
public void setName(java.lang.String name)
If this mail folder denotes the root folder, DEFAULT_FOLDER_NAME is supposed to be set as name.
name - the name to setpublic boolean isSubscribed()
If mailing system does not support subscription, true is supposed to be returned.
public boolean containsSubscribed()
setSubscribed(boolean).true if subscribed is set; otherwise falsepublic void removeSubscribed()
public void setSubscribed(boolean subscribed)
If mailing system does not support subscription, true is supposed to be set as subscription status.
subscribed - the subscription status to setpublic int getDeletedMessageCount()
-1 if this mail folder does not hold messagesisHoldsMessages()public boolean containsDeletedMessageCount()
setDeletedMessageCount(int).true if deletedMessageCount is set; otherwise falsepublic void removeDeletedMessageCount()
public void setDeletedMessageCount(int deletedMessageCount)
deletedMessageCount - The number of messages marked for deletion or -1 if this mail folder does not hold messagespublic boolean exists()
true if folder exists in mailbox; otherwise falsepublic boolean containsExists()
setExists(boolean).true if exists status is set; otherwise falsepublic void removeExists()
public void setExists(boolean exists)
exists - true if folder exists in mailbox; otherwise falsepublic int getMessageCount()
-1 if this mail folder does not hold messagesisHoldsMessages()public boolean containsMessageCount()
setMessageCount(int).true if messageCount is set; otherwise falsepublic void removeMessageCount()
public void setMessageCount(int messageCount)
messageCount - The number of messages or -1 if this mail folder does not hold messagespublic int getNewMessageCount()
-1 if this mail folder does not hold messages.isHoldsMessages()public boolean containsNewMessageCount()
setNewMessageCount(int).true if newMessageCount is set; otherwise falsepublic void removeNewMessageCount()
public void setNewMessageCount(int newMessageCount)
newMessageCount - The number of new messages or -1 if this mail folder does not hold messagespublic int getUnreadMessageCount()
-1 if this mail folder does not hold messagesisHoldsMessages()public boolean containsUnreadMessageCount()
setUnreadMessageCount(int).true if unreadMessageCount is set; otherwise falsepublic void removeUnreadMessageCount()
public void setUnreadMessageCount(int unreadMessageCount)
unreadMessageCount - The number of unread messages or -1 if this mail folder does not hold messagespublic char getSeparator()
MailConfig#getDefaultSeparator()public boolean containsSeparator()
setSeparator(char).true if separator is set; otherwise falsepublic void removeSeparator()
public void setSeparator(char separator)
If mailing system does not support a separator character, MailConfig#getDefaultSeparator() should to be used.
separator - the separator to setpublic java.lang.String getParentFullname()
null if this mail folder denotes the root folderpublic boolean containsParentFullname()
setParentFullname(String).true if parentFullname is set; otherwise falsepublic void removeParentFullname()
public void setParentFullname(java.lang.String parentFullname)
If this mail folder denotes the root folder, null is supposed to be set.
parentFullname - the parent fullname to setpublic boolean isHoldsMessages()
true if this folder is able to hold messages; otherwise falsepublic boolean containsHoldsMessages()
setHoldsMessages(boolean).true if the holds-messages flag is set; otherwise falsepublic void removeHoldsMessages()
public void setHoldsMessages(boolean holdsMessages)
holdsMessages - true if folder holds messages; otherwise falsepublic boolean isHoldsFolders()
true if this folder is able to hold folders; otherwise falsepublic boolean containsHoldsFolders()
setHoldsFolders(boolean).true if this folder has the holds-folder flag set; otherwise falsepublic void removeHoldsFolders()
public void setHoldsFolders(boolean holdsFolders)
holdsFolders - true if folder holds folders; otherwise falsepublic MailPermission getOwnPermission()
The returned permission should reflect user's permission regardless if mailing system supports permissions or not. An instance of
DefaultMailPermission is supposed to be returned on missing permissions support except for the root folder. The root folder
should indicate no object permissions in any case, but the folder permission varies if mailing system allows subfolder creation below
root folder or not. The returned permission must reflect the allowed behavior.
public boolean containsOwnPermission()
setOwnPermission(MailPermission).true if own permission is set; otherwise falsepublic void removeOwnPermission()
public void setOwnPermission(MailPermission ownPermission)
Apply an instance of DefaultMailPermission if mailing system does not support permissions, except if this mail folder denotes
the root folder, then apply null or altered instance of DefaultMailPermission with no object permissions but properly reflects folder
permission as described in getOwnPermission().
Please note that even if the mail system does not support permissions the entity must be set on the DefaultMailPermission
object. Please use OCLPermission.setEntity(int) for this.
ownPermission - The own permission to setpublic boolean isRootFolder()
true if this folder denotes the root folder; otherwise falsepublic boolean containsRootFolder()
setRootFolder(boolean).true if root-folder flag is set; otherwise falsepublic void removeRootFolder()
public void setRootFolder(boolean rootFolder)
rootFolder - the root folder flag to setpublic boolean isDefaultFolder()
true if this folder denotes a default folder; otherwise falsepublic boolean containsDefaultFolder()
setDefaultFolder(boolean).true if default-folder flag is set; otherwise falsepublic void removeDefaultFolder()
public void setDefaultFolder(boolean defaultFolder)
defaultFolder - the default folder flag to setpublic void addPermission(MailPermission permission)
permission - The permission to addpublic void addPermissions(MailPermission[] permissions)
permissions - The array of permissions to addpublic void addPermissions(java.util.Collection<? extends MailPermission> permissions)
permissions - The collection of permissions to addpublic boolean containsPermissions()
addPermission(MailPermission), addPermissions(Collection), or
addPermissions(MailPermission[]).true if permissions are set; otherwise falsepublic void removePermissions()
public MailPermission[] getPermissions()
MailPermissionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isSupportsUserFlags()
true if this folder supports user flags; otherwise falsepublic boolean containsSupportsUserFlags()
setSupportsUserFlags(boolean).true if supportsUserFlags is set; otherwise falsepublic void removeSupportsUserFlags()
public void setSupportsUserFlags(boolean supportsUserFlags)
supportsUserFlags - the supports-user-flags flag to setpublic boolean isShared()
true if this folder is shared; otherwise falsepublic boolean containsShared()
true if shared flag is set; otherwise falsepublic void removeShared()
public void setShared(boolean shared)
shared - The shared flag to setpublic boolean isPublic()
true if this folder is public; otherwise falsepublic boolean containsPublic()
true if public flag is set; otherwise falsepublic void removePublic()
public void setPublic(boolean isPublic)
isPublic - The public flag to setpublic java.lang.String getOwner()
null.
Note: isShared() needs to return true.
nullpublic boolean containsOwner()
true if owner is set; otherwise falsepublic void removeOwne()
public void setOwner(java.lang.String owner)
null.
Note: setShared(boolean) needs to be invoked with true.
owner - The owner