com.atlassian.confluence.mail
Class DefaultMailContentManager

java.lang.Object
  extended by com.atlassian.confluence.core.DefaultContentEntityManager
      extended by com.atlassian.confluence.mail.DefaultMailContentManager
All Implemented Interfaces:
ContentEntityManager, MailContentManager

public class DefaultMailContentManager
extends DefaultContentEntityManager
implements MailContentManager


Field Summary
 
Fields inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
attachmentManager, contentEntityObjectDao, eventManager, indexer, labelManager, linkManager
 
Fields inherited from interface com.atlassian.confluence.core.ContentEntityManager
ITERATE_ALL
 
Constructor Summary
DefaultMailContentManager()
           
 
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)
          Get a mail by its database id.
 Mail getMailByMessageId(String messageId)
          Get a mail by its message-id.
 Mail getMailItemFromSpace(Space space, String messageId)
           
 List getMailsByMessageId(String messageId)
          Get all mails with the matching message-id.
 List getSpaceMail(int firstResult, int maxResults, String spaceKey)
          Get a particular subset (page) of mail from a space.
 Iterator getSpaceMailIterator(String spaceKey)
           
 Iterator getSpaceMailWithAttachmentsIterator(String spaceKey)
           
protected  void publishCreateEvent(ContentEntityObject obj)
          This method publishes *CreateEventss.
protected  void publishRemoveEvent(ContentEntityObject obj)
          This method publishes *RemoveEvents.
protected  void publishUpdateEvent(ContentEntityObject obj, ContentEntityObject origObj, SaveContext saveContext)
          This method publishes *UpdateEvents.
 void removeAllMail(Space space)
          removes all mail in a space including their attachments
 void removeAttachmentsForMail(Mail mail)
           
 void removeMail(Mail mail)
          removes mail and its associated attachments
 boolean spaceHasMail(String spaceKey)
           
 Mail storeIncomingMail(Space space, byte[] rawMessage)
          Create a new mail content object in the given space for the given raw RFC822 message.
 Mail storeIncomingMail(Space space, javax.mail.internet.MimeMessage mimeMessage)
          Create a new mail content object in the given space for the given mimeMessage.
 
Methods inherited from class com.atlassian.confluence.core.DefaultContentEntityManager
getAllCurrentEntities, getById, getEventManager, getLockedBySpace, getNextVersion, getOtherVersion, getPageDao, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, revertContentEntityBackToVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, setAttachmentManager, setContentEntityObjectDao, setEventManager, setIndexer, setLabelManager, setLinkManager, updateContentLinkingTo, updateContentLinkingTo, updateOutgoingLinksInContent, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 
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.ContentEntityManager
getAllCurrentEntities, getById, getLockedBySpace, getNextVersion, getOtherVersion, getPreviousVersion, getRecentlyAddedEntities, getRecentlyModifiedEntities, getRecentlyModifiedEntitiesForUser, getRecentlyModifiedForChangeDigest, getVersionHistorySummaries, refreshContentEntity, removeContentEntity, revertContentEntityBackToVersion, revertContentEntityBackToVersion, saveContentEntity, saveContentEntity, setEventManager, updateContentLinkingTo, updateOutgoingLinksInContent, updateSingleContentLinkinTo, updateSingleContentLinkinTo
 

Constructor Detail

DefaultMailContentManager

public DefaultMailContentManager()
Method Detail

getMailById

public Mail getMailById(long id)
Description copied from interface: MailContentManager
Get a mail by its database id. If the mail does not exist, null is returned.

Specified by:
getMailById in interface MailContentManager

getSpaceMailIterator

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

getSpaceMailWithAttachmentsIterator

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

getSpaceMail

public List getSpaceMail(int firstResult,
                         int maxResults,
                         String spaceKey)
Get a particular subset (page) of mail from a space.

Specified by:
getSpaceMail in interface MailContentManager
Parameters:
firstResult - index of the first record from the resulting resultset
maxResults - the maximum number of records to retrieve after this index
spaceKey - the key for the space from which to remove the mail
Returns:
the specified window of mail from the space

findMailTotal

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

getMail

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

getMailByMessageId

public Mail getMailByMessageId(String messageId)
Get a mail by its message-id. If the mail does not exist, or if there are multiple mails with the same message id

Specified by:
getMailByMessageId in interface MailContentManager

getMailsByMessageId

public List getMailsByMessageId(String messageId)
Get all mails with the matching message-id. Mostly you won't need to use this, as you'll generally be looking for a single message, message ids are reasonably unique, and the single-mail method is less code.

Specified by:
getMailsByMessageId in interface MailContentManager
Parameters:
messageId - the message id of the mails to retrieve
Returns:
a list of all messages matching that ID

storeIncomingMail

public Mail storeIncomingMail(Space space,
                              byte[] rawMessage)
Description copied from interface: MailContentManager
Create a new mail content object in the given space for the given raw RFC822 message. The message should be in the raw form it was received in. All post-arrival munging such as filter application, multipart content decisions and attachment removal happen inside this method

We use a byte array because RFC822 messages are streams of bytes - character encoding happens after the header is parsed

Specified by:
storeIncomingMail in interface MailContentManager
Parameters:
space - the space to attach the message to
rawMessage - the message that has been received

spaceHasMail

public boolean spaceHasMail(String spaceKey)
Specified by:
spaceHasMail in interface MailContentManager

getFirstMailAfter

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

getFirstMailBefore

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

removeMail

public void removeMail(Mail mail)
Description copied from interface: MailContentManager
removes mail and its associated attachments

Specified by:
removeMail in interface MailContentManager

removeAllMail

public void removeAllMail(Space space)
removes all mail in a space including their attachments

Specified by:
removeAllMail in interface MailContentManager
Parameters:
space - the space from which to remove the mail

removeAttachmentsForMail

public void removeAttachmentsForMail(Mail mail)
Specified by:
removeAttachmentsForMail in interface MailContentManager

getMailItemFromSpace

public Mail getMailItemFromSpace(Space space,
                                 String messageId)
Returns:
com.atlassian.confluence.Mail which matches messageId, otherwise null.

storeIncomingMail

public Mail storeIncomingMail(Space space,
                              javax.mail.internet.MimeMessage mimeMessage)
                       throws ConfluenceException
Description copied from interface: MailContentManager
Create a new mail content object in the given space for the given mimeMessage. The message should be in the raw form it was received in. All post-arrival munging such as filter application, multipart content decisions and attachment removal happen inside this method

Specified by:
storeIncomingMail in interface MailContentManager
Parameters:
space - the space to attach the message to
mimeMessage - the message that has been received
Throws:
ConfluenceException

publishCreateEvent

protected void publishCreateEvent(ContentEntityObject obj)
Description copied from class: DefaultContentEntityManager
This method publishes *CreateEventss. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishCreateEvent in class DefaultContentEntityManager
Parameters:
obj - the created content entity object

publishRemoveEvent

protected void publishRemoveEvent(ContentEntityObject obj)
Description copied from class: DefaultContentEntityManager
This method publishes *RemoveEvents. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishRemoveEvent in class DefaultContentEntityManager
Parameters:
obj - the removed content entity object

publishUpdateEvent

protected void publishUpdateEvent(ContentEntityObject obj,
                                  ContentEntityObject origObj,
                                  SaveContext saveContext)
Description copied from class: DefaultContentEntityManager
This method publishes *UpdateEvents. Specific content entity object manager that need to publish those events should override this method.

Overrides:
publishUpdateEvent in class DefaultContentEntityManager
Parameters:
obj - the updated content entity object
origObj - the old version of the content entity object, for history purpose
saveContext - the associated SaveContext


Copyright © 2003-2011 Atlassian. All Rights Reserved.