com.openexchange.messaging
Class DefaultMessagingFolder

java.lang.Object
  extended by com.openexchange.messaging.DefaultMessagingFolder
All Implemented Interfaces:
MessagingFolder

public class DefaultMessagingFolder
extends java.lang.Object
implements MessagingFolder

DefaultMessagingFolder - The default messaging folder providing setter methods.

Author:
Thorben Betten

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.openexchange.messaging.MessagingFolder
MessagingFolder.DefaultFolderType
 
Field Summary
 
Fields inherited from interface com.openexchange.messaging.MessagingFolder
CAPABILITY_PERMISSIONS, CAPABILITY_QUOTA, CAPABILITY_SORT, CAPABILITY_SUBSCRIPTION, CAPABILITY_USER_FLAGS, ROOT_FULLNAME
 
Constructor Summary
DefaultMessagingFolder()
          Initializes a new DefaultMessagingFolder.
 
Method Summary
 void addPermission(MessagingPermission permission)
          Adds given permission.
 boolean containsDefaultFolder()
          Indicates whether this folder has the default-folder flag set
 boolean containsDefaultFolderType()
          Checks if default folder type was applied to this messaging folder.
 boolean containsHoldsFolders()
          Indicates whether this folder has the holds-folders flag set
 boolean containsHoldsMessages()
          Indicates whether this folder has the holds-messages flag set
 boolean containsRootFolder()
          Indicates whether this folder has the root-folder flag set
 boolean containsSeparator()
          Checks if separator character was set through setSeparator(char).
 boolean containsSubfolders()
          Indicates whether this folder has the has-subfolders flag set
 boolean containsSubscribed()
          Indicates whether this folder has the subscribed flag set
 boolean containsSubscribedSubfolders()
          Indicates whether this folder has the has-subscribed-subfolders flag set
 boolean exists()
          Indicates whether this folder exists in folder storage.
 java.util.Set<java.lang.String> getCapabilities()
          Gets the capabilities of this folder; e.g "QUOTA", "PERMISSIONS", etc.
 MessagingFolder.DefaultFolderType getDefaultFolderType()
          Gets the default folder type.
 int getDeletedMessageCount()
          Gets the number of messages marked for deletion in this folder
 java.lang.String getId()
          Gets the identifier.
 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).
 MessagingPermission getOwnPermission()
          Gets the permission for currently logged-in user accessing this folder The returned permission should reflect user's permission regardless if messaging system supports permissions or not.
 java.lang.String getParentId()
          Gets the parent identifier or null if this messaging folder denotes the root folder.
 java.util.List<MessagingPermission> getPermissions()
          Gets the permissions associated with this messaging folder.
 char getSeparator()
          Gets the separator character.
 int getUnreadMessageCount()
          Gets the number of unread messages.
 boolean hasSubfolders()
          Checks if this messaging folder has subfolders.
 boolean hasSubscribedSubfolders()
          Checks if this messaging folder has subscribed subfolders.
 boolean isDefaultFolder()
          Checks if this folder denotes a default folder (Drafts, Sent, Trash, etc.)
 boolean isHoldsFolders()
          Checks if this folder is able to hold folders.
 boolean isHoldsMessages()
          Checks if this folder is able to hold messages.
 boolean isRootFolder()
          Checks if this folder denotes the root folder
 boolean isSubscribed()
          Checks whether the denoted messaging folder is subscribed or not.
 void removeDefaultFolder()
          Removes whether this folder is a default folder.
 void removeDefaultFolderType()
          Removes the default folder type.
 void removeHoldsFolders()
          Removes whether this folder holds folders.
 void removeHoldsMessages()
          Removes whether this folder holds messages.
 void removeRootFolder()
          Removes whether this folder is the root folder.
 void removeSeparator()
          Removes the separator character.
 void removeSubfolders()
          Removes whether this folder has subfolders.
 void removeSubscribed()
          Removes whether this folder is subscribed.
 void removeSubscribedSubfolders()
          Removes whether this folder has subscribed subfolders.
 void setCapabilities(java.util.Set<java.lang.String> capabilities)
          Sets the capabilities.
 void setDefaultFolder(boolean defaultFolder)
          Sets whether this folder is a default folder.
 void setDefaultFolderType(MessagingFolder.DefaultFolderType defaultFolderType)
          Sets the default folder type.
 void setDeletedMessageCount(int deletedMessageCount)
          Sets the deleted message count.
 void setExists(boolean exists)
          Sets whether this folder exists in folder storage.
 void setHoldsFolders(boolean holdsFolders)
          Sets whether this folder has the capability to hold subfolders.
 void setHoldsMessages(boolean holdsMessages)
          Sets whether this folder has the capability to hold messages.
 void setId(java.lang.String id)
          Sets the folder identifier.
 void setMessageCount(int messageCount)
          Sets the message count.
 void setName(java.lang.String name)
          Sets the name.
 void setNewMessageCount(int newMessageCount)
          Sets the new message count.
 void setOwnPermission(MessagingPermission ownPermission)
          Sets the own permission.
 void setParentId(java.lang.String parentId)
          Sets the parent identifier.
 void setPermissions(java.util.List<MessagingPermission> permissions)
          Sets the permissions
 void setRootFolder(boolean rootFolder)
          Sets if this folder is the root folder.
 void setSeparator(char separator)
          Sets the separator character.
 void setSubfolders(boolean subfolders)
          Sets whether this folder has subfolders.
 void setSubscribed(boolean subscribed)
          Sets if this folder is subscribed.
 void setSubscribedSubfolders(boolean subscribedSubfolders)
          Sets whether this folder has subscribed subfolders.
 void setUnreadMessageCount(int unreadMessageCount)
          Sets the unread message count.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessagingFolder

public DefaultMessagingFolder()
Initializes a new DefaultMessagingFolder.

Method Detail

containsDefaultFolderType

public boolean containsDefaultFolderType()
Description copied from interface: MessagingFolder
Checks if default folder type was applied to this messaging folder.

Specified by:
containsDefaultFolderType in interface MessagingFolder
Returns:
true if default folder type is applied; otherwise false

getDefaultFolderType

public MessagingFolder.DefaultFolderType getDefaultFolderType()
Description copied from interface: MessagingFolder
Gets the default folder type.

Specified by:
getDefaultFolderType in interface MessagingFolder
Returns:
The default folder type or MessagingFolder.DefaultFolderType.NONE if not available

setDefaultFolderType

public void setDefaultFolderType(MessagingFolder.DefaultFolderType defaultFolderType)
Sets the default folder type.

Parameters:
defaultFolderType - The default folder type

removeDefaultFolderType

public void removeDefaultFolderType()
Removes the default folder type.


getCapabilities

public java.util.Set<java.lang.String> getCapabilities()
Gets the capabilities of this folder; e.g "QUOTA", "PERMISSIONS", etc.

Specified by:
getCapabilities in interface MessagingFolder
Returns:
The list of capabilities or null if not set

setCapabilities

public void setCapabilities(java.util.Set<java.lang.String> capabilities)
Sets the capabilities.

Parameters:
capabilities - The capabilities

getDeletedMessageCount

public int getDeletedMessageCount()
Description copied from interface: MessagingFolder
Gets the number of messages marked for deletion in this folder

Specified by:
getDeletedMessageCount in interface MessagingFolder
Returns:
The number of messages marked for deletion in this folder or -1 if this messaging folder does not hold messages
See Also:
MessagingFolder.isHoldsMessages()

setDeletedMessageCount

public void setDeletedMessageCount(int deletedMessageCount)
Sets the deleted message count.

Parameters:
deletedMessageCount - The deleted message count

getId

public java.lang.String getId()
Description copied from interface: MessagingFolder
Gets the identifier.

Specified by:
getId in interface MessagingFolder
Returns:
The identifier

setId

public void setId(java.lang.String id)
Sets the folder identifier.

Parameters:
id - The folder identifier

getMessageCount

public int getMessageCount()
Description copied from interface: MessagingFolder
Gets the number of messages.

Specified by:
getMessageCount in interface MessagingFolder
Returns:
The number of messages or -1 if this messaging folder does not hold messages
See Also:
MessagingFolder.isHoldsMessages()

setMessageCount

public void setMessageCount(int messageCount)
Sets the message count.

Parameters:
messageCount - The message count

getName

public java.lang.String getName()
Description copied from interface: MessagingFolder
Gets the name.

Specified by:
getName in interface MessagingFolder
Returns:
The name

setName

public void setName(java.lang.String name)
Sets the name.

Parameters:
name - The name to set

getNewMessageCount

public int getNewMessageCount()
Description copied from interface: MessagingFolder
Gets the number of new messages (since last time this folder was accessed).

Specified by:
getNewMessageCount in interface MessagingFolder
Returns:
The number of new messages or -1 if this messaging folder does not hold messages.
See Also:
MessagingFolder.isHoldsMessages()

setNewMessageCount

public void setNewMessageCount(int newMessageCount)
Sets the new message count.

Parameters:
newMessageCount - The new message count

getOwnPermission

public MessagingPermission getOwnPermission()
Description copied from interface: MessagingFolder
Gets the permission for currently logged-in user accessing this folder

The returned permission should reflect user's permission regardless if messaging system supports permissions or not. An instance of DefaultMessagingPermission 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 messaging system allows subfolder creation below root folder or not. The returned permission must reflect the allowed behavior.

Specified by:
getOwnPermission in interface MessagingFolder
Returns:
The own permission

setOwnPermission

public void setOwnPermission(MessagingPermission ownPermission)
Sets the own permission.

Parameters:
ownPermission - The own permission

getParentId

public java.lang.String getParentId()
Description copied from interface: MessagingFolder
Gets the parent identifier or null if this messaging folder denotes the root folder.

Specified by:
getParentId in interface MessagingFolder
Returns:
The parent identifier or null if this messaging folder denotes the root folder

setParentId

public void setParentId(java.lang.String parentId)
Sets the parent identifier.

Parameters:
parentId - The parent identifier

getPermissions

public java.util.List<MessagingPermission> getPermissions()
Description copied from interface: MessagingFolder
Gets the permissions associated with this messaging folder.

Specified by:
getPermissions in interface MessagingFolder
Returns:
The permissions as a collection of MessagingPermission

setPermissions

public void setPermissions(java.util.List<MessagingPermission> permissions)
Sets the permissions

Parameters:
permissions - The permissions

addPermission

public void addPermission(MessagingPermission permission)
Adds given permission.

Parameters:
permission - The permission

getUnreadMessageCount

public int getUnreadMessageCount()
Description copied from interface: MessagingFolder
Gets the number of unread messages.

Specified by:
getUnreadMessageCount in interface MessagingFolder
Returns:
The number of unread messages or -1 if this messaging folder does not hold messages
See Also:
MessagingFolder.isHoldsMessages()

setUnreadMessageCount

public void setUnreadMessageCount(int unreadMessageCount)
Sets the unread message count.

Parameters:
unreadMessageCount - The unread message count

hasSubfolders

public boolean hasSubfolders()
Description copied from interface: MessagingFolder
Checks if this messaging folder has subfolders.

Specified by:
hasSubfolders in interface MessagingFolder
Returns:
true if this messaging folder has subfolders; otherwise false

setSubfolders

public void setSubfolders(boolean subfolders)
Sets whether this folder has subfolders.

Parameters:
subfolders - true if this folder has subfolders; otherwise false

containsSubfolders

public boolean containsSubfolders()
Indicates whether this folder has the has-subfolders flag set

Returns:
true if this folder has the has-subfolders flag set; otherwise false

removeSubfolders

public void removeSubfolders()
Removes whether this folder has subfolders.


hasSubscribedSubfolders

public boolean hasSubscribedSubfolders()
Description copied from interface: MessagingFolder
Checks if this messaging folder has subscribed subfolders.

Specified by:
hasSubscribedSubfolders in interface MessagingFolder
Returns:
true if this messaging folder has subscribed subfolders; otherwise false

setSubscribedSubfolders

public void setSubscribedSubfolders(boolean subscribedSubfolders)
Sets whether this folder has subscribed subfolders.

Parameters:
subscribedSubfolders - true if this folder has subscribed subfolders; otherwise false

containsSubscribedSubfolders

public boolean containsSubscribedSubfolders()
Indicates whether this folder has the has-subscribed-subfolders flag set

Returns:
true if this folder has the has-subscribed-subfolders flag set; otherwise false

removeSubscribedSubfolders

public void removeSubscribedSubfolders()
Removes whether this folder has subscribed subfolders.


isDefaultFolder

public boolean isDefaultFolder()
Description copied from interface: MessagingFolder
Checks if this folder denotes a default folder (Drafts, Sent, Trash, etc.)

Specified by:
isDefaultFolder in interface MessagingFolder
Returns:
true if this folder denotes a default folder; otherwise false

setDefaultFolder

public void setDefaultFolder(boolean defaultFolder)
Sets whether this folder is a default folder.

Parameters:
defaultFolder - true if this folder is a default folder; otherwise false

containsDefaultFolder

public boolean containsDefaultFolder()
Indicates whether this folder has the default-folder flag set

Returns:
true if this folder has the default-folder flag set; otherwise false

removeDefaultFolder

public void removeDefaultFolder()
Removes whether this folder is a default folder.


isHoldsFolders

public boolean isHoldsFolders()
Description copied from interface: MessagingFolder
Checks if this folder is able to hold folders.

Specified by:
isHoldsFolders in interface MessagingFolder
Returns:
true if this folder is able to hold folders; otherwise false

setHoldsFolders

public void setHoldsFolders(boolean holdsFolders)
Sets whether this folder has the capability to hold subfolders.

Parameters:
holdsFolders - true if this folder has the capability to hold subfolders; otherwise false

containsHoldsFolders

public boolean containsHoldsFolders()
Indicates whether this folder has the holds-folders flag set

Returns:
true if this folder has the holds-folders flag set; otherwise false

removeHoldsFolders

public void removeHoldsFolders()
Removes whether this folder holds folders.


isHoldsMessages

public boolean isHoldsMessages()
Description copied from interface: MessagingFolder
Checks if this folder is able to hold messages.

Specified by:
isHoldsMessages in interface MessagingFolder
Returns:
true if this folder is able to hold messages; otherwise false

containsHoldsMessages

public boolean containsHoldsMessages()
Indicates whether this folder has the holds-messages flag set

Returns:
true if this folder has the holds-messages flag set; otherwise false

removeHoldsMessages

public void removeHoldsMessages()
Removes whether this folder holds messages.


setHoldsMessages

public void setHoldsMessages(boolean holdsMessages)
Sets whether this folder has the capability to hold messages.

Parameters:
holdsMessages - true if this folder has the capability to hold messages; otherwise false

isRootFolder

public boolean isRootFolder()
Description copied from interface: MessagingFolder
Checks if this folder denotes the root folder

Specified by:
isRootFolder in interface MessagingFolder
Returns:
true if this folder denotes the root folder; otherwise false

setRootFolder

public void setRootFolder(boolean rootFolder)
Sets if this folder is the root folder.

Parameters:
rootFolder - true if this folder is the root folder; otherwise false

containsRootFolder

public boolean containsRootFolder()
Indicates whether this folder has the root-folder flag set

Returns:
true if this folder has the root-folder flag set; otherwise false

removeRootFolder

public void removeRootFolder()
Removes whether this folder is the root folder.


isSubscribed

public boolean isSubscribed()
Description copied from interface: MessagingFolder
Checks whether the denoted messaging folder is subscribed or not.

If messaging system does not support subscription, true is supposed to be returned.

Specified by:
isSubscribed in interface MessagingFolder
Returns:
Whether the denoted messaging folder is subscribed or not

setSubscribed

public void setSubscribed(boolean subscribed)
Sets if this folder is subscribed.

Parameters:
subscribed - true if this folder is subscribed; otherwise false

containsSubscribed

public boolean containsSubscribed()
Indicates whether this folder has the subscribed flag set

Returns:
true if this folder has the subscribed flag set; otherwise false

removeSubscribed

public void removeSubscribed()
Removes whether this folder is subscribed.


exists

public boolean exists()
Indicates whether this folder exists in folder storage.

Returns:
true if this folder exists in folder storage; otherwise false

setExists

public void setExists(boolean exists)
Sets whether this folder exists in folder storage.

Parameters:
exists - true if this folder exists in folder storage; otherwise false

getSeparator

public char getSeparator()
Description copied from interface: MessagingFolder
Gets the separator character.

Specified by:
getSeparator in interface MessagingFolder
Returns:
The separator character.

containsSeparator

public boolean containsSeparator()
Checks if separator character was set through setSeparator(char).

Returns:
true if separator is set; otherwise false

removeSeparator

public void removeSeparator()
Removes the separator character.


setSeparator

public void setSeparator(char separator)
Sets the separator character.

If mailing system does not support a separator character, MailConfig#getDefaultSeparator() should to be used.

Parameters:
separator - the separator to set