com.atlassian.confluence.mail.persistence.dao.hibernate
Class HibernateMailDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.hibernate.HibernateObjectDao
              extended by com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
                  extended by com.atlassian.confluence.core.persistence.hibernate.ContentEntityObjectHibernateDao
                      extended by com.atlassian.confluence.mail.persistence.dao.hibernate.HibernateMailDao
All Implemented Interfaces:
ObjectDao, ContentEntityObjectDao, VersionedObjectDao, MailDao, org.springframework.beans.factory.InitializingBean

public class HibernateMailDao
extends ContentEntityObjectHibernateDao
implements MailDao


Field Summary
 
Fields inherited from class com.atlassian.confluence.core.persistence.hibernate.ContentEntityObjectHibernateDao
ONE_DAY
 
Fields inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
cacheFactory
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
HibernateMailDao()
           
 
Method Summary
 int findMailTotal(Space space)
           
 Mail getFirstMailAfter(String spaceKey, long mailId)
           
 Mail getFirstMailBefore(String spaceKey, long mailId)
           
 List getMail(Space space, boolean currentOnly)
           
 Mail getMailById(long id)
          Retrieve a single mail by its persistent object id.
 Mail getMailByMessageId(String messageId)
          Retrieve a single mail by its message-id.
 List getMailsByMessageId(String messageId)
          Retrieve all mails with a particular message id.
 Mail getMostRecentMail(String spaceKey)
           
 Class getPersistentClass()
           
 List getSpaceMail(int firstResult, int maxResults, String spaceKey)
           
 Iterator getSpaceMailIterator(String spaceKey)
           
 Iterator getSpaceMailWithAttachmentsIterator(String spaceKey)
           
 void removeAllMail(Space space)
          bulk mail removal using direct jdbc (too slow using hibernate, as it loads all mails into session prior to deletion which is bad)
 
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.ContentEntityObjectHibernateDao
countContentBySpaceIdAndStatus, findContentBySpaceIdAndStatus, findPreviousVersions, getAllCurrentEntities, getById, getContentAuthoredByUser, getFirstVersionAfter, getFirstVersionBefore, getLastEditedVersionsOf, getLockedContentBySpace, getObjectType, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getTrashedContent, getVersion, getVersionHistorySummary
 
Methods inherited from class com.atlassian.confluence.core.persistence.hibernate.VersionedHibernateObjectDao
findAllSorted, findLatestVersionsCount, findLatestVersionsIterator, save, setCacheFactory, updateModificationData
 
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao
findAll, findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, getCountResult, index, refresh, reIndex, remove, replicate, save, saveRaw, setIndexer, unIndex
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.confluence.core.persistence.ContentEntityObjectDao
countContentBySpaceIdAndStatus, findContentBySpaceIdAndStatus, findPreviousVersions, getAllCurrentEntities, getById, getContentAuthoredByUser, getFirstVersionAfter, getFirstVersionBefore, getLastEditedVersionsOf, getLockedContentBySpace, getObjectType, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getTrashedContent, getVersion, getVersionHistorySummary
 
Methods inherited from interface com.atlassian.confluence.core.persistence.VersionedObjectDao
findLatestVersionsCount, findLatestVersionsIterator, save
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, findAllSorted, refresh, remove, replicate, save, saveRaw
 

Constructor Detail

HibernateMailDao

public HibernateMailDao()
Method Detail

getPersistentClass

public Class getPersistentClass()
Specified by:
getPersistentClass in interface ObjectDao
Overrides:
getPersistentClass in class ContentEntityObjectHibernateDao

getMailById

public Mail getMailById(long id)
Description copied from interface: MailDao
Retrieve a single mail by its persistent object id. Returns null if no Mail is found with that id

Specified by:
getMailById in interface MailDao
Parameters:
id - the id of the mail to retrieve
Returns:
the appropriate Mail object, or null if no such mail exists

getMailByMessageId

public Mail getMailByMessageId(String messageId)
Description copied from interface: MailDao
Retrieve a single mail by its message-id. Since message ids are not guaranteed to be unique (but should be in practice), this method will return null both if no message exists with that ID, or if multiple mails exist with that ID. To determine which is the case, call MailDao.getMailsByMessageId(java.lang.String).

Message ids are case sensitive.

Specified by:
getMailByMessageId in interface MailDao
Parameters:
messageId - the Message-Id of the mail to retrieve
Returns:
the appropriate Mail object, or null if no such mail exists, or if multiple mails exist with that ID

getMailsByMessageId

public List getMailsByMessageId(String messageId)
Description copied from interface: MailDao
Retrieve all mails with a particular message id. Since message ids are supposed to be unique, you will mostly want to just use MailDao.getMailByMessageId(java.lang.String) instead, but this method is useful if you want to cater for the possibility of (unlikely) accidental clashes or (more likely) deliberate forgeries.

Message ids are case sensitive

Specified by:
getMailsByMessageId in interface MailDao
Parameters:
messageId - The Message-Id of the mail to retrieve
Returns:
a list of all mails matching that message-id, or the empty list if no such mails exist.

getMostRecentMail

public Mail getMostRecentMail(String spaceKey)
Specified by:
getMostRecentMail in interface MailDao

getFirstMailAfter

public Mail getFirstMailAfter(String spaceKey,
                              long mailId)
Specified by:
getFirstMailAfter in interface MailDao

getFirstMailBefore

public Mail getFirstMailBefore(String spaceKey,
                               long mailId)
Specified by:
getFirstMailBefore in interface MailDao

getSpaceMailIterator

public Iterator getSpaceMailIterator(String spaceKey)
Specified by:
getSpaceMailIterator in interface MailDao

getSpaceMailWithAttachmentsIterator

public Iterator getSpaceMailWithAttachmentsIterator(String spaceKey)
Specified by:
getSpaceMailWithAttachmentsIterator in interface MailDao

findMailTotal

public int findMailTotal(Space space)
Specified by:
findMailTotal in interface MailDao

getSpaceMail

public List getSpaceMail(int firstResult,
                         int maxResults,
                         String spaceKey)
Specified by:
getSpaceMail in interface MailDao

getMail

public List getMail(Space space,
                    boolean currentOnly)
Specified by:
getMail in interface MailDao

removeAllMail

public void removeAllMail(Space space)
bulk mail removal using direct jdbc (too slow using hibernate, as it loads all mails into session prior to deletion which is bad)

Specified by:
removeAllMail in interface MailDao
Parameters:
space -


Copyright © 2003-2012 Atlassian. All Rights Reserved.