public interface MessageMapper<Id> extends Mapper
Message
in a MessageManager
. A MessageMapper
has a lifecycle from the start of a request
to the end of the request.Modifier and Type | Interface and Description |
---|---|
static class |
MessageMapper.FetchType
Specify what data needs to get filled in a
Message before returning it |
Mapper.Transaction<T>, Mapper.VoidTransaction
Modifier and Type | Method and Description |
---|---|
MessageMetaData |
add(Mailbox<Id> mailbox,
Message<Id> message)
Add the given
Message to the underlying storage. |
MessageMetaData |
copy(Mailbox<Id> mailbox,
Message<Id> original)
Copy the given
Message to a new mailbox and return the uid of the copy. |
long |
countMessagesInMailbox(Mailbox<Id> mailbox)
Return the count of messages in the mailbox
|
long |
countUnseenMessagesInMailbox(Mailbox<Id> mailbox)
Return the count of unseen messages in the mailbox
|
void |
delete(Mailbox<Id> mailbox,
Message<Id> message)
Delete the given
Message |
Map<Long,MessageMetaData> |
expungeMarkedForDeletionInMailbox(Mailbox<Id> mailbox,
MessageRange set)
Return a
Iterator which holds the uids for all deleted Messages for the given MessageRange which are marked for deletion
The list must be ordered |
Long |
findFirstUnseenMessageUid(Mailbox<Id> mailbox)
Return the uid of the first unseen message.
|
Iterator<Message<Id>> |
findInMailbox(Mailbox<Id> mailbox,
MessageRange set,
MessageMapper.FetchType type,
int limit)
|
List<Long> |
findRecentMessageUidsInMailbox(Mailbox<Id> mailbox)
Return a List of
Message which are recent. |
long |
getHighestModSeq(Mailbox<Id> mailbox)
Return the higest mod-sequence which were used for storing a Message in the
Mailbox |
long |
getLastUid(Mailbox<Id> mailbox)
Return the last uid which were used for storing a Message in the
Mailbox |
Iterator<UpdatedFlags> |
updateFlags(Mailbox<Id> mailbox,
javax.mail.Flags flags,
boolean value,
boolean replace,
MessageRange set)
Update flags for the given
MessageRange . |
endRequest, execute
Iterator<Message<Id>> findInMailbox(Mailbox<Id> mailbox, MessageRange set, MessageMapper.FetchType type, int limit) throws MailboxException
Iterator
which holds the messages for the given criterias
The list must be ordered by the Message
uidmailbox
- The mailbox to searchset
- message range for batch processingtype
- limit
- the maximal limit of returned Message
's. Use -1 to set no limit. In any case the caller MUST not expect the limit to get applied in all cases as the implementation
MAY just ignore itMailboxException
Map<Long,MessageMetaData> expungeMarkedForDeletionInMailbox(Mailbox<Id> mailbox, MessageRange set) throws MailboxException
Iterator
which holds the uids for all deleted Messages for the given MessageRange
which are marked for deletion
The list must be orderedmailbox
- set
- MailboxException
long countMessagesInMailbox(Mailbox<Id> mailbox) throws MailboxException
mailbox
- MailboxException
long countUnseenMessagesInMailbox(Mailbox<Id> mailbox) throws MailboxException
mailbox
- StorageException
MailboxException
void delete(Mailbox<Id> mailbox, Message<Id> message) throws MailboxException
Message
mailbox
- message
- StorageException
MailboxException
Long findFirstUnseenMessageUid(Mailbox<Id> mailbox) throws MailboxException
mailbox
- StorageException
MailboxException
List<Long> findRecentMessageUidsInMailbox(Mailbox<Id> mailbox) throws MailboxException
mailbox
- StorageException
MailboxException
MessageMetaData add(Mailbox<Id> mailbox, Message<Id> message) throws MailboxException
Message
to the underlying storage. Be aware that implementation may choose to replace the uid of the given message while storing.
So you should only depend on the returned uid.mailbox
- message
- StorageException
MailboxException
Iterator<UpdatedFlags> updateFlags(Mailbox<Id> mailbox, javax.mail.Flags flags, boolean value, boolean replace, MessageRange set) throws MailboxException
MessageRange
. Only the flags may be modified after a message was saved to a mailbox.mailbox
- flags
- value
- replace
- set
- MailboxException
MessageMetaData copy(Mailbox<Id> mailbox, Message<Id> original) throws MailboxException
Message
to a new mailbox and return the uid of the copy. Be aware that the given uid is just a suggestion for the uid of the copied
message. Implementation may choose to use a different one, so only depend on the returned uid!mailbox
- the Mailbox to copy tooriginal
- the original to copyStorageException
MailboxException
long getLastUid(Mailbox<Id> mailbox) throws MailboxException
Mailbox
mailbox
- MailboxException
long getHighestModSeq(Mailbox<Id> mailbox) throws MailboxException
Mailbox
mailbox
- MailboxException
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.