com.atlassian.confluence.pages
Class DefaultAttachmentManager

java.lang.Object
  extended bycom.atlassian.confluence.pages.AbstractAttachmentManager
      extended bycom.atlassian.confluence.pages.DefaultAttachmentManager
All Implemented Interfaces:
AttachmentManager
Direct Known Subclasses:
WebDavAttachmentManager

public class DefaultAttachmentManager
extends AbstractAttachmentManager

Default implementation of AttachmentManager. The storage location of attachments is not defined, and is handled by the AttachmentDao.


Field Summary
protected  org.apache.log4j.Category log
           
 
Constructor Summary
DefaultAttachmentManager()
           
 
Method Summary
 List getAllVersions(Attachment attachment)
          Get all versions of an attachment, starting with the current version
 AttachmentDao getAttachmentDao()
          Retrieves the AttachmentDao for the AttachmentManager
 InputStream getAttachmentData(Attachment attachment)
          Retrieve the data for attachment
 List getAttachments(ContentEntityObject content)
          Returns a list of all attachments, old and new.
 List getAttachments(ListQuery query, int firstResult)
           
 AttachmentDao.AttachmentCopier getCopier(AttachmentManager destination)
          Retrieves a AttachmentDao.AttachmentCopier that will allow the attachments from one data store to be copied across to another.
 List getLatestVersionsOfAttachments(ContentEntityObject content)
          b Returns a list of only latest versions of attachments.
 AttachmentDao.AttachmentMigrator getMigrator(AttachmentManager destination)
          Retrieves a AttachmentDao.AttachmentMigrator that will allow the attachments from one data store to be moved across to another.
 void moveAttachment(Attachment latestVersion, String newFileName, ContentEntityObject newContent)
           
 void removeAttachmentFromServer(Attachment latestVersion)
          Removes the attachment and all previous versions
protected  void saveNewAttachment(Attachment attachment, InputStream attachmentData)
           
protected  void saveNewAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream attachmentData)
           
 void setAttachmentDao(AttachmentDao attachmentDao)
           
 void setAttachmentData(Attachment attachment, InputStream attachmentData)
          Set the data belonging to attachment This method can be used when there is missing data for an Attachment (e.g.
 
Methods inherited from class com.atlassian.confluence.pages.AbstractAttachmentManager
getAttachment, getAttachment, getPreviousVersions, getThumbnailManager, removeAttachments, removeThumbnail, saveAttachment, setThumbnailManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.log4j.Category log
Constructor Detail

DefaultAttachmentManager

public DefaultAttachmentManager()
Method Detail

getAttachmentData

public InputStream getAttachmentData(Attachment attachment)
Description copied from interface: AttachmentManager
Retrieve the data for attachment

Parameters:
attachment - the Attachment the data belongs to
Returns:
InputStream representing the data

saveNewAttachment

protected void saveNewAttachment(Attachment attachment,
                                 InputStream attachmentData)
                          throws IOException
Specified by:
saveNewAttachment in class AbstractAttachmentManager
Throws:
IOException

saveNewAttachmentVersion

protected void saveNewAttachmentVersion(Attachment attachment,
                                        Attachment previousVersion,
                                        InputStream attachmentData)
                                 throws IOException
Specified by:
saveNewAttachmentVersion in class AbstractAttachmentManager
Throws:
IOException

getLatestVersionsOfAttachments

public List getLatestVersionsOfAttachments(ContentEntityObject content)
Description copied from interface: AttachmentManager
b Returns a list of only latest versions of attachments.


getAttachments

public List getAttachments(ContentEntityObject content)
Description copied from interface: AttachmentManager
Returns a list of all attachments, old and new.


getAttachments

public List getAttachments(ListQuery query,
                           int firstResult)

removeAttachmentFromServer

public void removeAttachmentFromServer(Attachment latestVersion)
Removes the attachment and all previous versions

Parameters:
latestVersion - latest version of the attachment to remove

moveAttachment

public void moveAttachment(Attachment latestVersion,
                           String newFileName,
                           ContentEntityObject newContent)
Parameters:
latestVersion - The attachment to be moved
newFileName - New name of the file
newContent - The new contentEntiityObject which will be parent to the attachment

setAttachmentData

public void setAttachmentData(Attachment attachment,
                              InputStream attachmentData)
                       throws AttachmentDataExistsException
Description copied from interface: AttachmentManager
Set the data belonging to attachment This method can be used when there is missing data for an Attachment (e.g. during imports) and the data needs to be set manually.

Parameters:
attachment - Attachment the data belongs to
attachmentData - the data to be saved
Throws:
AttachmentDataExistsException - if data for attachment already exists

getMigrator

public AttachmentDao.AttachmentMigrator getMigrator(AttachmentManager destination)
Description copied from interface: AttachmentManager
Retrieves a AttachmentDao.AttachmentMigrator that will allow the attachments from one data store to be moved across to another.

Parameters:
destination - the AttachmentManager the data is being moved to
Returns:
an AttachmentMigrator object

getCopier

public AttachmentDao.AttachmentCopier getCopier(AttachmentManager destination)
Description copied from interface: AttachmentManager
Retrieves a AttachmentDao.AttachmentCopier that will allow the attachments from one data store to be copied across to another.

Parameters:
destination - the AttachmentManager the data is being copied to
Returns:
an AttachmentCopier object

getAttachmentDao

public AttachmentDao getAttachmentDao()
Description copied from interface: AttachmentManager
Retrieves the AttachmentDao for the AttachmentManager

Returns:
An AttachmentDao instance

getAllVersions

public List getAllVersions(Attachment attachment)
Description copied from interface: AttachmentManager
Get all versions of an attachment, starting with the current version


setAttachmentDao

public void setAttachmentDao(AttachmentDao attachmentDao)


Confluence is developed by Atlassian.