public abstract class MailFolderStorage extends java.lang.Object implements IMailFolderStorage
MailFolderStorage - Abstract implementation of IMailFolderStorage.EMPTY_PATH| Constructor and Description |
|---|
MailFolderStorage() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
checkDefaultFolders()
Checks user's default folder as defined in user's mail settings and creates them if any is missing.
|
void |
clearFolder(java.lang.String fullName)
Deletes the content of the folder identified through given full name.
|
abstract void |
clearFolder(java.lang.String fullName,
boolean hardDelete)
Deletes the content of the folder identified through given full name.
|
abstract java.lang.String |
createFolder(MailFolderDescription toCreate)
Creates a new mail folder with attributes taken from given mail folder description
|
java.lang.String |
deleteFolder(java.lang.String fullName)
Deletes an existing mail folder identified through given full name.
|
abstract java.lang.String |
deleteFolder(java.lang.String fullName,
boolean hardDelete)
Deletes an existing mail folder identified through given full name.
|
abstract boolean |
exists(java.lang.String fullName)
Checks if a folder exists whose full name matches given
fullName |
abstract java.lang.String |
getConfirmedHamFolder()
Gets the full name of default confirmed ham folder
|
abstract java.lang.String |
getConfirmedSpamFolder()
Gets the full name of default confirmed spam folder
|
java.lang.String |
getDefaultFolderPrefix()
Gets the prefix (incl. separator character) for default folders.
|
abstract java.lang.String |
getDraftsFolder()
Gets the full name of default drafts folder
|
abstract MailFolder |
getFolder(java.lang.String fullName)
Gets the folder identified through given full name
|
Quota |
getMessageQuota(java.lang.String fullName)
Detects both quota limit and quota usage of MESSAGE resource on given mailbox folder's quota-root.
|
MailFolder[] |
getPath2DefaultFolder(java.lang.String fullName)
Gets the reverse path from the folder identified through given full name to parental default folder.
|
abstract Quota[] |
getQuotas(java.lang.String fullName,
Quota.Type[] types)
Detects both quotas' limit and usage on given mailbox folder's quota-root for specified resource types.
|
MailFolder |
getRootFolder()
Gets the mailbox's root folder.
|
abstract java.lang.String |
getSentFolder()
Gets the full name of default sent folder
|
abstract java.lang.String |
getSpamFolder()
Gets the full name of default spam folder
|
Quota |
getStorageQuota(java.lang.String fullName)
Detects both quota limit and quota usage of STORAGE resource on given mailbox folder's quota-root.
|
abstract MailFolder[] |
getSubfolders(java.lang.String parentFullName,
boolean all)
Gets the first level subfolders located below the folder whose fullName matches given parameter
parentFullName. |
abstract java.lang.String |
getTrashFolder()
Gets the full name of default trash folder
|
abstract java.lang.String |
moveFolder(java.lang.String fullName,
java.lang.String newFullName)
Moves the folder identified through given full name to the path specified through argument
newFullName. |
abstract void |
releaseResources()
Releases all used resources when closing parental
MailAccess |
java.lang.String |
renameFolder(java.lang.String fullName,
java.lang.String newName)
Renames the folder identified through given full name to the specified new name.
|
abstract java.lang.String |
updateFolder(java.lang.String fullName,
MailFolderDescription toUpdate)
Updates an existing mail folder identified through given full name.
|
public abstract boolean exists(java.lang.String fullName)
throws com.openexchange.exception.OXException
IMailFolderStoragefullNameexists in interface IMailFolderStoragefullName - The full nametrue if folder exists in mailbox; otherwise falsecom.openexchange.exception.OXException - If existence cannot be checkedpublic abstract MailFolder getFolder(java.lang.String fullName) throws com.openexchange.exception.OXException
IMailFolderStoragegetFolder in interface IMailFolderStoragefullName - The full nameMailFoldercom.openexchange.exception.OXException - If either folder does not exist or could not be fetchedpublic abstract MailFolder[] getSubfolders(java.lang.String parentFullName, boolean all) throws com.openexchange.exception.OXException
IMailFolderStorageparentFullName.
If no subfolders exist below identified folder the constant IMailFolderStorage.EMPTY_PATH should be returned.
getSubfolders in interface IMailFolderStorageparentFullName - The parent full nameall - Whether all or only subscribed subfolders shall be returned. If underlying mailing system does not support folder
subscription, this argument should always be treated as true.MailFolder representing the subfolderscom.openexchange.exception.OXException - If either parent folder does not exist or its subfolders cannot be deliveredpublic MailFolder getRootFolder() throws com.openexchange.exception.OXException
This is a convenience method that invokes getFolder(String) with its parameter set to MailFolder.DEFAULT_FOLDER_ID.
It may be overridden if a faster way can be achieved by specific implementation.
getRootFolder in interface IMailFolderStoragecom.openexchange.exception.OXException - If mailbox's default folder cannot be deliveredpublic abstract void checkDefaultFolders()
throws com.openexchange.exception.OXException
IMailFolderStorage
See also createConfirmedSpam(),
createConfirmedHam(), and
unsubscribeSpamFolders().
checkDefaultFolders in interface IMailFolderStoragecom.openexchange.exception.OXException - If user's default folder could not be checkedpublic abstract java.lang.String createFolder(MailFolderDescription toCreate) throws com.openexchange.exception.OXException
IMailFolderStoragecreateFolder in interface IMailFolderStoragetoCreate - The mail folder to createcom.openexchange.exception.OXException - If creation failspublic abstract java.lang.String updateFolder(java.lang.String fullName,
MailFolderDescription toUpdate)
throws com.openexchange.exception.OXException
IMailFolderStorageThe currently known attributes that make sense being updated are:
MailFolderDescription.containsPermissions() returns
trueMailFolderDescription.containsSubscribed()
returns trueMailFolderDescription class to do so.
Note: If underlying mailing system does not support the corresponding capability, the update is treated as a no-op. For
example if both MailCapabilities.hasPermissions() and MailCapabilities.hasSubscription() indicate false,
the associated update operations are not going to be performed.
updateFolder in interface IMailFolderStoragefullName - The full name of the mail folder to updatetoUpdate - The mail folder to update containing only the modified fieldscom.openexchange.exception.OXException - If either folder does not exist or cannot be updatedpublic abstract java.lang.String moveFolder(java.lang.String fullName,
java.lang.String newFullName)
throws com.openexchange.exception.OXException
IMailFolderStoragenewFullName. Thus a rename can
be implicitly performed.
E.g.:
my.path.to.folder -> my.newpath.to.folder
moveFolder in interface IMailFolderStoragefullName - The folder full namenewFullName - The new full name to move tocom.openexchange.exception.OXException - If either folder does not exist or cannot be movedpublic java.lang.String renameFolder(java.lang.String fullName,
java.lang.String newName)
throws com.openexchange.exception.OXException
Since a rename is a move operation in the same (parent) folder, this is only a convenience method that may be overridden if necessary.
E.g.:
my.path.to.folder -> my.path.to.newfolder
renameFolder in interface IMailFolderStoragefullName - The folder full namenewName - The new namecom.openexchange.exception.OXException - If either folder does not exist or cannot be renamedpublic java.lang.String deleteFolder(java.lang.String fullName)
throws com.openexchange.exception.OXException
IMailFolderStorage
This is a convenience method that invokes IMailFolderStorage.deleteFolder(String, boolean) with hardDelete set to
false.
deleteFolder in interface IMailFolderStoragefullName - The full name of the mail folder to deletecom.openexchange.exception.OXException - If either folder does not exist or cannot be deletedpublic abstract java.lang.String deleteFolder(java.lang.String fullName,
boolean hardDelete)
throws com.openexchange.exception.OXException
IMailFolderStorage
If hardDelete is not set and folder is not located below default trash folder it is backed up (including subfolder tree)
in default trash folder; otherwise it is deleted permanently.
While another backup folder with the same name already exists below default trash folder, an increasing serial number is appended to folder name until its name is unique inside default trash folder's subfolders. E.g.: If folder "DeleteMe" already exists below default trash folder, the next name would be "DeleteMe2". If again a folder "DeleteMe2" already exists below default trash folder, the next name would be "DeleteMe3", and so no.
If default trash folder cannot hold subfolders, the folder is either deleted permanently or an appropriate exception may be thrown.
deleteFolder in interface IMailFolderStoragefullName - The full name of the mail folder to deletehardDelete - Whether to delete permanently or to backup into trash foldercom.openexchange.exception.OXException - If either folder does not exist or cannot be deletedpublic void clearFolder(java.lang.String fullName)
throws com.openexchange.exception.OXException
IMailFolderStorageclearFolder in interface IMailFolderStoragefullName - The full name of the mail folder whose content should be clearedcom.openexchange.exception.OXException - If either folder does not exist or its content cannot be clearedpublic abstract void clearFolder(java.lang.String fullName,
boolean hardDelete)
throws com.openexchange.exception.OXException
IMailFolderStorageclearFolder in interface IMailFolderStoragefullName - The full name of the mail folder whose content should be clearedhardDelete - Whether to delete permanently or to backup into trash foldercom.openexchange.exception.OXException - If either folder does not exist or its content cannot be clearedpublic MailFolder[] getPath2DefaultFolder(java.lang.String fullName) throws com.openexchange.exception.OXException
IMailFolderStorageMailFolder instances.getPath2DefaultFolder in interface IMailFolderStoragefullName - The folder full nameMailFolder instances.com.openexchange.exception.OXException - If either folder does not exist or path cannot be determinedpublic Quota getStorageQuota(java.lang.String fullName) throws com.openexchange.exception.OXException
IMailFolderStorage
Note that the Quota.getLimit() and Quota.getUsage() is in 1024 octets.
getStorageQuota in interface IMailFolderStoragefullName - The folder full name (if null "INBOX" is used)com.openexchange.exception.OXException - If either folder does not exist or quota limit and/or quote usage cannot be determinedpublic Quota getMessageQuota(java.lang.String fullName) throws com.openexchange.exception.OXException
IMailFolderStoragegetMessageQuota in interface IMailFolderStoragefullName - The folder full name (if null "INBOX" is used)com.openexchange.exception.OXException - If either folder does not exist or quota limit and/or quote usage cannot be determinedpublic abstract Quota[] getQuotas(java.lang.String fullName, Quota.Type[] types) throws com.openexchange.exception.OXException
IMailFolderStorage
If no quota restriction exists for a certain resource type, both quota usage and limit value carry constant Quota.UNLIMITED
to indicate no limitations on that resource type.
Note that the Quota.getLimit() and Quota.getUsage() returned for Quota.Type#STORAGE quota is in 1024 octets.
getQuotas in interface IMailFolderStoragefullName - The folder full name (if null "INBOX" is used)types - The desired quota resource typescom.openexchange.exception.OXException - If either folder does not exist or quota limit and/or quote usage cannot be determinedpublic java.lang.String getDefaultFolderPrefix()
throws com.openexchange.exception.OXException
By now a compound full name is assumed. Override if not appropriate.
getDefaultFolderPrefix in interface IMailFolderStoragecom.openexchange.exception.OXException - If a mail error occurspublic abstract java.lang.String getConfirmedHamFolder()
throws com.openexchange.exception.OXException
IMailFolderStoragegetConfirmedHamFolder in interface IMailFolderStoragecom.openexchange.exception.OXException - If confirmed ham folder's full name cannot be returnedpublic abstract java.lang.String getConfirmedSpamFolder()
throws com.openexchange.exception.OXException
IMailFolderStoragegetConfirmedSpamFolder in interface IMailFolderStoragecom.openexchange.exception.OXException - If confirmed spam folder's full name cannot be returnedpublic abstract java.lang.String getDraftsFolder()
throws com.openexchange.exception.OXException
IMailFolderStoragegetDraftsFolder in interface IMailFolderStoragecom.openexchange.exception.OXException - If draft folder's full name cannot be returnedpublic abstract java.lang.String getSpamFolder()
throws com.openexchange.exception.OXException
IMailFolderStoragegetSpamFolder in interface IMailFolderStoragecom.openexchange.exception.OXException - If spam folder's full name cannot be returnedpublic abstract java.lang.String getSentFolder()
throws com.openexchange.exception.OXException
IMailFolderStoragegetSentFolder in interface IMailFolderStoragecom.openexchange.exception.OXException - If sent folder's full name cannot be returnedpublic abstract java.lang.String getTrashFolder()
throws com.openexchange.exception.OXException
IMailFolderStoragegetTrashFolder in interface IMailFolderStoragecom.openexchange.exception.OXException - If trash folder's full name cannot be returnedpublic abstract void releaseResources()
throws com.openexchange.exception.OXException
IMailFolderStorageMailAccessreleaseResources in interface IMailFolderStoragecom.openexchange.exception.OXException - If resources cannot be released