org.apache.james.mailbox.jpa.mail
Class JPAMessageMapper

java.lang.Object
  extended by org.apache.james.mailbox.store.transaction.TransactionalMapper
      extended by org.apache.james.mailbox.jpa.JPATransactionalMapper
          extended by org.apache.james.mailbox.jpa.mail.JPAMessageMapper
All Implemented Interfaces:
MessageMapper<Long>, Mapper

public class JPAMessageMapper
extends JPATransactionalMapper
implements MessageMapper<Long>

JPA implementation of a MessageMapper. This class is not thread-safe!


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.james.mailbox.store.transaction.Mapper
Mapper.MailboxMembershipCallback<Id>, Mapper.Transaction<T>, Mapper.VoidTransaction
 
Field Summary
 
Fields inherited from class org.apache.james.mailbox.jpa.JPATransactionalMapper
entityManager, entityManagerFactory
 
Constructor Summary
JPAMessageMapper(javax.persistence.EntityManagerFactory entityManagerFactory)
           
 
Method Summary
 long add(Mailbox<Long> mailbox, Message<Long> message)
           
 long copy(Mailbox<Long> mailbox, long uid, Message<Long> original)
           
 long countMessagesInMailbox(Mailbox<Long> mailbox)
           
 long countUnseenMessagesInMailbox(Mailbox<Long> mailbox)
           
 void delete(Mailbox<Long> mailbox, Message<Long> message)
           
 Iterator<Long> expungeMarkedForDeletionInMailbox(Mailbox<Long> mailbox, MessageRange set)
           
 Long findFirstUnseenMessageUid(Mailbox<Long> mailbox)
           
 void findInMailbox(Mailbox<Long> mailbox, MessageRange set, Mapper.MailboxMembershipCallback<Long> callback)
           
 List<Message<Long>> findRecentMessagesInMailbox(Mailbox<Long> mailbox)
           
 Iterator<UpdatedFlags> updateFlags(Mailbox<Long> mailbox, javax.mail.Flags flags, boolean value, boolean replace, MessageRange set)
           
 
Methods inherited from class org.apache.james.mailbox.jpa.JPATransactionalMapper
begin, commit, endRequest, getEntityManager, rollback
 
Methods inherited from class org.apache.james.mailbox.store.transaction.TransactionalMapper
execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.james.mailbox.store.transaction.Mapper
endRequest, execute
 

Constructor Detail

JPAMessageMapper

public JPAMessageMapper(javax.persistence.EntityManagerFactory entityManagerFactory)
Method Detail

findInMailbox

public void findInMailbox(Mailbox<Long> mailbox,
                          MessageRange set,
                          Mapper.MailboxMembershipCallback<Long> callback)
                   throws MailboxException
Specified by:
findInMailbox in interface MessageMapper<Long>
Throws:
MailboxException
See Also:
org.apache.james.mailbox.store.mail.MessageMapper#findInMailbox(org.apache.james.mailbox.MessageRange)

expungeMarkedForDeletionInMailbox

public Iterator<Long> expungeMarkedForDeletionInMailbox(Mailbox<Long> mailbox,
                                                        MessageRange set)
                                                 throws MailboxException
Specified by:
expungeMarkedForDeletionInMailbox in interface MessageMapper<Long>
Throws:
MailboxException

countMessagesInMailbox

public long countMessagesInMailbox(Mailbox<Long> mailbox)
                            throws MailboxException
Specified by:
countMessagesInMailbox in interface MessageMapper<Long>
Throws:
MailboxException
See Also:
org.apache.james.mailbox.store.mail.MessageMapper#countMessagesInMailbox()

countUnseenMessagesInMailbox

public long countUnseenMessagesInMailbox(Mailbox<Long> mailbox)
                                  throws MailboxException
Specified by:
countUnseenMessagesInMailbox in interface MessageMapper<Long>
Throws:
MailboxException
See Also:
org.apache.james.mailbox.store.mail.MessageMapper#countUnseenMessagesInMailbox()

delete

public void delete(Mailbox<Long> mailbox,
                   Message<Long> message)
            throws MailboxException
Specified by:
delete in interface MessageMapper<Long>
Throws:
MailboxException

findFirstUnseenMessageUid

public Long findFirstUnseenMessageUid(Mailbox<Long> mailbox)
                               throws MailboxException
Specified by:
findFirstUnseenMessageUid in interface MessageMapper<Long>
Throws:
MailboxException

findRecentMessagesInMailbox

public List<Message<Long>> findRecentMessagesInMailbox(Mailbox<Long> mailbox)
                                                throws MailboxException
Specified by:
findRecentMessagesInMailbox in interface MessageMapper<Long>
Throws:
MailboxException
See Also:
org.apache.james.mailbox.store.mail.MessageMapper#findRecentMessagesInMailbox()

add

public long add(Mailbox<Long> mailbox,
                Message<Long> message)
         throws MailboxException
Specified by:
add in interface MessageMapper<Long>
Throws:
MailboxException

copy

public long copy(Mailbox<Long> mailbox,
                 long uid,
                 Message<Long> original)
          throws MailboxException
Specified by:
copy in interface MessageMapper<Long>
Throws:
MailboxException

updateFlags

public Iterator<UpdatedFlags> updateFlags(Mailbox<Long> mailbox,
                                          javax.mail.Flags flags,
                                          boolean value,
                                          boolean replace,
                                          MessageRange set)
                                   throws MailboxException
Specified by:
updateFlags in interface MessageMapper<Long>
Throws:
MailboxException


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.