|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.openexchange.mail.api.MailMessageStorage
com.openexchange.mail.api.enhanced.MailMessageStorageLong
public abstract class MailMessageStorageLong
MailMessageStorageLong - Enhances MailMessageStorage to delegate its methods to number-based invocations.
| Field Summary |
|---|
| Fields inherited from interface com.openexchange.mail.api.IMailMessageStorage |
|---|
EMPTY_RETVAL |
| Constructor Summary | |
|---|---|
MailMessageStorageLong()
|
|
| Method Summary | |
|---|---|
java.lang.String[] |
appendMessages(java.lang.String destFolder,
MailMessage[] msgs)
Appends given messages to given folder. |
abstract long[] |
appendMessagesLong(java.lang.String destFolder,
MailMessage[] msgs)
Appends given messages to given folder. |
java.lang.String[] |
copyMessages(java.lang.String sourceFolder,
java.lang.String destFolder,
java.lang.String[] mailIds,
boolean fast)
Copies the mails identified through given mail IDs from source folder to destination folder. |
abstract long[] |
copyMessagesLong(java.lang.String sourceFolder,
java.lang.String destFolder,
long[] mailIds,
boolean fast)
Copies the mails identified through given mail IDs from source folder to destination folder. |
void |
deleteMessages(java.lang.String folder,
java.lang.String[] mailIds,
boolean hardDelete)
Deletes the messages located in given folder identified through given mail IDs. |
abstract void |
deleteMessagesLong(java.lang.String folder,
long[] mailIds,
boolean hardDelete)
Deletes the messages located in given folder identified through given mail IDs. |
MailMessage[] |
getAllMessages(java.lang.String folder,
IndexRange indexRange,
MailSortField sortField,
OrderDirection order,
MailField[] fields)
A convenience method that delivers all messages contained in given folder through invoking searchMessages() without search
arguments. |
MailPart |
getAttachment(java.lang.String folder,
java.lang.String mailId,
java.lang.String sequenceId)
A convenience method that fetches the mail message's attachment identified through given sequenceId. |
MailPart |
getAttachmentLong(java.lang.String folder,
long mailId,
java.lang.String sequenceId)
A convenience method that fetches the mail message's attachment identified through given sequenceId. |
MailPart |
getImageAttachment(java.lang.String folder,
java.lang.String mailId,
java.lang.String contentId)
A convenience method that fetches the mail message's image attachment identified by its Content-Id header given through
argument contentId. |
MailPart |
getImageAttachmentLong(java.lang.String folder,
long mailId,
java.lang.String contentId)
A convenience method that fetches the mail message's image attachment identified by its Content-Id header given through
argument contentId. |
MailMessage |
getMessage(java.lang.String folder,
java.lang.String mailId,
boolean markSeen)
Gets the mail located in given folder whose mail ID matches specified ID. |
MailMessage |
getMessageLong(java.lang.String folder,
long mailId,
boolean markSeen)
Gets the mail located in given folder whose mail ID matches specified ID. |
MailMessage[] |
getMessages(java.lang.String folder,
java.lang.String[] mailIds,
MailField[] fields)
Gets the mails located in given folder whose mail ID matches specified ID. |
abstract MailMessage[] |
getMessagesLong(java.lang.String folder,
long[] mailIds,
MailField[] fields)
Gets the mails located in given folder whose mail ID matches specified ID. |
MailMessage[] |
getThreadSortedMessages(java.lang.String folder,
IndexRange indexRange,
MailSortField sortField,
OrderDirection order,
SearchTerm<?> searchTerm,
MailField[] fields)
An optional convenience method that gets the messages located in given folder sorted by message thread reference. |
MailMessage[] |
getUnreadMessages(java.lang.String folder,
MailSortField sortField,
OrderDirection order,
MailField[] fields,
int limit)
Gets all unread messages located in given folder; meaning messages that do not have the \Seen flag set. |
java.lang.String[] |
moveMessages(java.lang.String sourceFolder,
java.lang.String destFolder,
java.lang.String[] mailIds,
boolean fast)
Moves the mails identified through given mail IDs from source folder to destination folder. |
long[] |
moveMessagesLong(java.lang.String sourceFolder,
java.lang.String destFolder,
long[] mailIds,
boolean fast)
Moves the mails identified through given mail IDs from source folder to destination folder. |
abstract void |
releaseResources()
Releases all resources used by this message storage when closing superior MailAccess |
MailMessage |
saveDraft(java.lang.String draftFullname,
ComposedMailMessage draftMail)
A convenience method that saves given draft mail to default drafts folder and supports deletion of old draft's version (draft-edit operation). |
abstract MailMessage[] |
searchMessages(java.lang.String folder,
IndexRange indexRange,
MailSortField sortField,
OrderDirection order,
SearchTerm<?> searchTerm,
MailField[] fields)
Searches mails located in given folder. |
void |
updateMessageColorLabel(java.lang.String folder,
java.lang.String[] mailIds,
int colorLabel)
An optional method that updates the color label of the messages specified by given mail IDs located in given folder. |
void |
updateMessageColorLabelLong(java.lang.String folder,
long[] mailIds,
int colorLabel)
An optional method that updates the color label of the messages specified by given mail IDs located in given folder. |
void |
updateMessageFlags(java.lang.String folder,
java.lang.String[] mailIds,
int flags,
boolean set)
Updates the flags of the messages specified by given mail IDs located in given folder. |
abstract void |
updateMessageFlagsLong(java.lang.String folder,
long[] mailIds,
int flags,
boolean set)
Updates the flags of the messages specified by given mail IDs located in given folder. |
| Methods inherited from class com.openexchange.mail.api.MailMessageStorage |
|---|
getDeletedMessages, getNewAndModifiedMessages |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MailMessageStorageLong()
| Method Detail |
|---|
public java.lang.String[] appendMessages(java.lang.String destFolder,
MailMessage[] msgs)
throws MailException
IMailMessageStorage
appendMessages in interface IMailMessageStorageappendMessages in class MailMessageStoragedestFolder - The destination foldermsgs - - The messages to append (must be completely pre-filled incl. content references)
MailException - If messages cannot be appended.
public abstract long[] appendMessagesLong(java.lang.String destFolder,
MailMessage[] msgs)
throws MailException
destFolder - The destination foldermsgs - - The messages to append (must be completely pre-filled incl. content references)
MailException - If messages cannot be appended.
public java.lang.String[] copyMessages(java.lang.String sourceFolder,
java.lang.String destFolder,
java.lang.String[] mailIds,
boolean fast)
throws MailException
IMailMessageStorage
If no mail could be found for a given mail ID, the corresponding value in returned array of String is null.
Moreover the implementation should take care if a copy operation from or to default drafts folder is performed. If so, this method should ensure that system flag DRAFT is enabled or disabled.
copyMessages in interface IMailMessageStoragecopyMessages in class MailMessageStoragesourceFolder - The source folder fullnamedestFolder - The destination folder fullnamemailIds - The mail IDs in source folderfast - true to perform a fast copy operation, meaning the corresponding mail IDs in destination folder are ignored
and an empty array of String is returned; otherwise false
MailException - If messages cannot be copied.
public abstract long[] copyMessagesLong(java.lang.String sourceFolder,
java.lang.String destFolder,
long[] mailIds,
boolean fast)
throws MailException
If no mail could be found for a given mail ID, the corresponding value in returned array of long is -1.
Moreover the implementation should take care if a copy operation from or to default drafts folder is performed. If so, this method should ensure that system flag DRAFT is enabled or disabled.
sourceFolder - The source folder fullnamedestFolder - The destination folder fullnamemailIds - The mail IDs in source folderfast - true to perform a fast copy operation, meaning the corresponding mail IDs in destination folder are ignored
and an empty array of long is returned; otherwise false
MailException - If messages cannot be copied.
public void deleteMessages(java.lang.String folder,
java.lang.String[] mailIds,
boolean hardDelete)
throws MailException
IMailMessageStorageIf no mail could be found for a given mail ID, it is treated as a no-op.
deleteMessages in interface IMailMessageStoragedeleteMessages in class MailMessageStoragefolder - The folder fullnamemailIds - The mail IDshardDelete - true to hard delete the messages, meaning not to create a backup copy of each message in default trash
folder; otherwise false
MailException - If messages cannot be deleted.
public abstract void deleteMessagesLong(java.lang.String folder,
long[] mailIds,
boolean hardDelete)
throws MailException
If no mail could be found for a given mail ID, it is treated as a no-op.
folder - The folder fullnamemailIds - The mail IDshardDelete - true to hard delete the messages, meaning not to create a backup copy of each message in default trash
folder; otherwise false
MailException - If messages cannot be deleted.
public MailMessage[] getAllMessages(java.lang.String folder,
IndexRange indexRange,
MailSortField sortField,
OrderDirection order,
MailField[] fields)
throws MailException
searchMessages() without search
arguments.
Note that sorting needs not to be supported by underlying mailing system. This can be done n application side, too
This method may be overridden in implementing subclass if a faster way can be achieved.
getAllMessages in interface IMailMessageStoragegetAllMessages in class MailMessageStoragefolder - The folder fullnameindexRange - The index range specifying the desired sub-list in sorted list; may be null to obtain complete list.
Range begins at the specified start index and extends to the message at index end - 1. Thus the length of the
range is end - start.sortField - The sort fieldorder - Whether ascending or descending sort orderfields - The fields to pre-fill in returned instances of MailMessage
MailMessage
MailException
public MailPart getAttachment(java.lang.String folder,
java.lang.String mailId,
java.lang.String sequenceId)
throws MailException
IMailMessageStoragesequenceId.
If no mail could be found for given mail ID, returned mail part is null.
getAttachment in interface IMailMessageStoragegetAttachment in class MailMessageStoragefolder - The folder fullnamemailId - The mail IDsequenceId - The attachment sequence ID
MailPart instance
MailException - If no attachment can be found whose sequence ID matches given sequenceId.
public MailPart getAttachmentLong(java.lang.String folder,
long mailId,
java.lang.String sequenceId)
throws MailException
sequenceId.
If no mail could be found for given mail ID, returned mail part is null.
folder - The folder fullnamemailId - The mail IDsequenceId - The attachment sequence ID
MailPart instance
MailException - If no attachment can be found whose sequence ID matches given sequenceId.
public MailPart getImageAttachment(java.lang.String folder,
java.lang.String mailId,
java.lang.String contentId)
throws MailException
IMailMessageStorageContent-Id header given through
argument contentId.
If no mail could be found for given mail ID, returned mail part is null.
getImageAttachment in interface IMailMessageStoragegetImageAttachment in class MailMessageStoragefolder - The folder fullnamemailId - The mail IDcontentId - The value of header Content-Id
MailPart instance
MailException - If no image can be found whose Content-Id header matches given contentId.
public MailPart getImageAttachmentLong(java.lang.String folder,
long mailId,
java.lang.String contentId)
throws MailException
Content-Id header given through
argument contentId.
If no mail could be found for given mail ID, returned mail part is null.
folder - The folder fullnamemailId - The mail IDcontentId - The value of header Content-Id
MailPart instance
MailException - If no image can be found whose Content-Id header matches given contentId.
public MailMessage getMessage(java.lang.String folder,
java.lang.String mailId,
boolean markSeen)
throws MailException
MailMessageStorage
This is a convenience method that invokes MailMessageStorage.getMessages(String, String[], MailField[]) with specified mail ID and
MailField.FULL. Thus the returned instance of MailMessage is completely pre-filled including content references.
If no mail could be found for given mail ID, null is returned.
This method may be overridden in implementing subclass if a faster way can be achieved.
getMessage in interface IMailMessageStoragegetMessage in class MailMessageStoragefolder - The folder fullnamemailId - The mail IDmarkSeen - true to explicitly mark corresponding mail as seen (setting system flag \Seen); otherwise
false to leave as-is
MailException - If message could not be returned
public MailMessage getMessageLong(java.lang.String folder,
long mailId,
boolean markSeen)
throws MailException
This is a convenience method that invokes getMessagesLong(String, long[], MailField[]) with specified mail ID and
MailField.FULL. Thus the returned instance of MailMessage is completely pre-filled including content references.
If no mail could be found for given mail ID, null is returned.
This method may be overridden in implementing subclass if a faster way can be achieved.
folder - The folder fullnamemailId - The mail IDmarkSeen - true to explicitly mark corresponding mail as seen (setting system flag \Seen); otherwise
false to leave as-is
MailException - If message could not be returned
public MailMessage[] getMessages(java.lang.String folder,
java.lang.String[] mailIds,
MailField[] fields)
throws MailException
IMailMessageStorageIMailMessageStorage.EMPTY_RETVAL may be returned, if
folder contains no messages.
The returned instances of MailMessage are pre-filled with specified fields through argument fields.
If any mail ID is invalid, null is returned for that entry.
getMessages in interface IMailMessageStoragegetMessages in class MailMessageStoragefolder - The folder fullnamemailIds - The mail IDsfields - The fields to pre-fill in returned instances of MailMessage
MailException - If message could not be returned
public abstract MailMessage[] getMessagesLong(java.lang.String folder,
long[] mailIds,
MailField[] fields)
throws MailException
IMailMessageStorage.EMPTY_RETVAL may be returned, if
folder contains no messages.
The returned instances of MailMessage are pre-filled with specified fields through argument fields.
If any mail ID is invalid, null is returned for that entry.
folder - The folder fullnamemailIds - The mail IDsfields - The fields to pre-fill in returned instances of MailMessage
MailException - If message could not be returned
public MailMessage[] getThreadSortedMessages(java.lang.String folder,
IndexRange indexRange,
MailSortField sortField,
OrderDirection order,
SearchTerm<?> searchTerm,
MailField[] fields)
throws MailException
null is returned assuming that mailing system does not support message thread reference, but may be overridden if it
does.
If underlying mailing system is IMAP, this method requires the IMAPv4 SORT extension or in detail the IMAP CAPABILITY
command should contain "SORT THREAD=ORDEREDSUBJECT THREAD=REFERENCES".
getThreadSortedMessages in interface IMailMessageStoragegetThreadSortedMessages in class MailMessageStoragefolder - The folder fullnameindexRange - The index range specifying the desired sub-list in sorted list; may be null to obtain complete list.
Range begins at the specified start index and extends to the message at index end - 1. Thus the length of the
range is end - start.sortField - The sort field applied to thread root elementsorder - Whether ascending or descending sort ordersearchTerm - The search termfields - The fields to pre-fill in returned instances of MailMessage
null if SORT is not supported by mail server
MailException - If messages cannot be returned
public MailMessage[] getUnreadMessages(java.lang.String folder,
MailSortField sortField,
OrderDirection order,
MailField[] fields,
int limit)
throws MailException
IMailMessageStorage.EMPTY_RETVAL may be returned if no unseen messages available in specified folder.
This is a convenience method that may be overridden if a faster way can be achieved.
getUnreadMessages in interface IMailMessageStoragegetUnreadMessages in class MailMessageStoragefolder - The folder fullnamesortField - The sort fieldorder - The sort orderfields - The fields to pre-fill in returned instances of MailMessagelimit - The max. number of returned unread messages or -1 to request all unread messages in folder
MailMessage
MailException - If unread messages cannot be returned.
public java.lang.String[] moveMessages(java.lang.String sourceFolder,
java.lang.String destFolder,
java.lang.String[] mailIds,
boolean fast)
throws MailException
MailMessageStorage
If no mail could be found for a given mail ID, the corresponding value in returned array of String is null.
This is a convenience method that may be overridden if a faster way can be achieved.
moveMessages in interface IMailMessageStoragemoveMessages in class MailMessageStoragesourceFolder - The source folder fullnamedestFolder - The destination folder fullnamemailIds - The mail IDs in source folderfast - true to perform a fast move operation, meaning the corresponding mail IDs in destination folder are ignored
and an empty array of String is returned; otherwise false
MailException - If messages cannot be copied.
public long[] moveMessagesLong(java.lang.String sourceFolder,
java.lang.String destFolder,
long[] mailIds,
boolean fast)
throws MailException
If no mail could be found for a given mail ID, the corresponding value in returned array of long is -1.
This is a convenience method that may be overridden if a faster way can be achieved.
sourceFolder - The source folder fullnamedestFolder - The destination folder fullnamemailIds - The mail IDs in source folderfast - true to perform a fast move operation, meaning the corresponding mail IDs in destination folder are ignored
and an empty array of String is returned; otherwise false
MailException - If messages cannot be copied.
public abstract void releaseResources()
throws MailException
MailAccess
releaseResources in interface IMailMessageStoragereleaseResources in class MailMessageStorageMailException - If resources cannot be released
public MailMessage saveDraft(java.lang.String draftFullname,
ComposedMailMessage draftMail)
throws MailException
saveDraft in interface IMailMessageStoragesaveDraft in class MailMessageStoragedraftFullname - The fullname of default drafts folderdraftMail - The draft mail as a composed mail
MailException - If saving specified draft message fails
public abstract MailMessage[] searchMessages(java.lang.String folder,
IndexRange indexRange,
MailSortField sortField,
OrderDirection order,
SearchTerm<?> searchTerm,
MailField[] fields)
throws MailException
IMailMessageStorage.EMPTY_RETVAL may be returned. This
method's purpose is to return filtered mails' headers for a fast list view. Therefore this method's fields
parameter should only contain instances of MailField which are marked as [low cost]. Otherwise pre-filling of returned
messages may take a long time and does no more fit to generate a fast list view.
Note that sorting needs not to be supported by underlying mailing system. This can be done on application side, too.
Same is for search, but in most cases it's faster to search on mailing system, but this heavily depends on how mails are accessed.
searchMessages in interface IMailMessageStoragesearchMessages in class MailMessageStoragefolder - The folder fullnameindexRange - The index range specifying the desired sub-list in sorted list; may be null to obtain complete list.
Range begins at the specified start index and extends to the message at index end - 1. Thus the length of the
range is end - start.sortField - The sort fieldorder - Whether ascending or descending sort ordersearchTerm - The search term to filter messages; may be null to obtain all messagesfields - The fields to pre-fill in returned instances of MailMessage
MailMessage
MailException - If mails cannot be returned
public void updateMessageColorLabel(java.lang.String folder,
java.lang.String[] mailIds,
int colorLabel)
throws MailException
If no mail could be found for a given mail ID, it is treated as a no-op.
The underlying mailing system needs to support some kind of user-definable flags to support this method. Otherwise this method should be left unchanged with an empty body.
The color labels are user flags with the common prefix "cl_" and its numeric color code appended (currently numbers 0 to
10).
updateMessageColorLabel in interface IMailMessageStorageupdateMessageColorLabel in class MailMessageStoragefolder - The folder fullnamemailIds - The mail IDscolorLabel - The color label to apply
MailException - If color label cannot be updated
public void updateMessageColorLabelLong(java.lang.String folder,
long[] mailIds,
int colorLabel)
throws MailException
If no mail could be found for a given mail ID, it is treated as a no-op.
The underlying mailing system needs to support some kind of user-definable flags to support this method. Otherwise this method should be left unchanged with an empty body.
The color labels are user flags with the common prefix "cl_" and its numeric color code appended (currently numbers 0 to
10).
folder - The folder fullnamemailIds - The mail IDscolorLabel - The color label to apply
MailException - If color label cannot be updated
public void updateMessageFlags(java.lang.String folder,
java.lang.String[] mailIds,
int flags,
boolean set)
throws MailException
IMailMessageStorageset is
true the affected flags denoted by flags are added; otherwise removed.
If no mail could be found for a given mail ID, it is treated as a no-op.
System flags are:
If mail folder in question supports user flags (storing individual strings per message) the virtual flags can also be updated through
this routine; e.g. MailMessage.FLAG_FORWARDED.
Moreover this routine checks for any spam related actions; meaning the MailMessage.FLAG_SPAM shall be enabled/disabled. Thus
the SpamHandler#handleSpam(String, String[], boolean, MailAccess)/
SpamHandler#handleHam(String, String[], boolean, MailAccess) methods needs to be executed.
updateMessageFlags in interface IMailMessageStorageupdateMessageFlags in class MailMessageStoragefolder - The folder fullnamemailIds - The mail IDsflags - The bit pattern for the flags to alterset - true to enable the flags; otherwise false
MailException - If system flags cannot be updated
public abstract void updateMessageFlagsLong(java.lang.String folder,
long[] mailIds,
int flags,
boolean set)
throws MailException
set is
true the affected flags denoted by flags are added; otherwise removed.
If no mail could be found for a given mail ID, it is treated as a no-op.
System flags are:
If mail folder in question supports user flags (storing individual strings per message) the virtual flags can also be updated through
this routine; e.g. MailMessage.FLAG_FORWARDED.
Moreover this routine checks for any spam related actions; meaning the MailMessage.FLAG_SPAM shall be enabled/disabled. Thus
the SpamHandler#handleSpam(String, String[], boolean, MailAccess)/
SpamHandler#handleHam(String, String[], boolean, MailAccess) methods needs to be executed.
folder - The folder fullnamemailIds - The mail IDsflags - The bit pattern for the flags to alterset - true to enable the flags; otherwise false
MailException - If system flags cannot be updated
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||