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

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.JPAMailboxMapper
All Implemented Interfaces:
MailboxMapper<Long>, Mapper

public class JPAMailboxMapper
extends JPATransactionalMapper
implements MailboxMapper<Long>

Data access management for mailbox.


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
JPAMailboxMapper(javax.persistence.EntityManagerFactory entityManagerFactory)
           
 
Method Summary
protected  void commit()
          Commit the transaction.
 void delete(Mailbox<Long> mailbox)
           
 void deleteAllMailboxes()
           
 void deleteAllMemberships()
           
 Mailbox<Long> findMailboxByPath(MailboxPath mailboxPath)
           
 List<Mailbox<Long>> findMailboxWithPathLike(MailboxPath path)
           
 boolean hasChildren(Mailbox<Long> mailbox, char delimiter)
           
 List<Mailbox<Long>> list()
           
 void save(Mailbox<Long> mailbox)
           
 
Methods inherited from class org.apache.james.mailbox.jpa.JPATransactionalMapper
begin, 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

JPAMailboxMapper

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

commit

protected void commit()
               throws MailboxException
Commit the transaction. If the commit fails due a conflict in a unique key constraint a MailboxExistsException will get thrown

Overrides:
commit in class JPATransactionalMapper
Throws:
MailboxException

save

public void save(Mailbox<Long> mailbox)
          throws MailboxException
Specified by:
save in interface MailboxMapper<Long>
Throws:
MailboxException
See Also:
MailboxMapper.save(Mailbox)

findMailboxByPath

public Mailbox<Long> findMailboxByPath(MailboxPath mailboxPath)
                                throws MailboxException,
                                       MailboxNotFoundException
Specified by:
findMailboxByPath in interface MailboxMapper<Long>
Throws:
MailboxException
MailboxNotFoundException
See Also:
org.apache.james.mailbox.store.mail.MailboxMapper#findMailboxByPath(java.lang.String)

delete

public void delete(Mailbox<Long> mailbox)
            throws MailboxException
Specified by:
delete in interface MailboxMapper<Long>
Throws:
MailboxException
See Also:
MailboxMapper.delete(Mailbox)

findMailboxWithPathLike

public List<Mailbox<Long>> findMailboxWithPathLike(MailboxPath path)
                                            throws MailboxException
Specified by:
findMailboxWithPathLike in interface MailboxMapper<Long>
Throws:
MailboxException

deleteAllMemberships

public void deleteAllMemberships()
                          throws MailboxException
Throws:
MailboxException

deleteAllMailboxes

public void deleteAllMailboxes()
                        throws MailboxException
Throws:
MailboxException

hasChildren

public boolean hasChildren(Mailbox<Long> mailbox,
                           char delimiter)
                    throws MailboxException,
                           MailboxNotFoundException
Specified by:
hasChildren in interface MailboxMapper<Long>
Throws:
MailboxException
MailboxNotFoundException
See Also:
org.apache.james.mailbox.store.mail.MailboxMapper#hasChildren(java.lang.String)

list

public List<Mailbox<Long>> list()
                         throws MailboxException
Specified by:
list in interface MailboxMapper<Long>
Throws:
MailboxException


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