com.atlassian.confluence.pages
Class DefaultAttachmentManager

java.lang.Object
  extended by com.atlassian.confluence.pages.AbstractAttachmentManager
      extended by com.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
 
Fields inherited from class com.atlassian.confluence.pages.AbstractAttachmentManager
eventManager
 
Constructor Summary
DefaultAttachmentManager()
           
 
Method Summary
 java.util.List getAllVersions(Attachment attachment)
          Get all versions of an attachment, starting with the current version
 AttachmentDao getAttachmentDao()
          Retrieves the AttachmentDao for the AttachmentManager
 java.io.InputStream getAttachmentData(Attachment attachment)
          Retrieve the data for attachment
 java.util.List getAttachments(ContentEntityObject content)
          Returns a list of all attachments, old and new.
 java.util.List getAttachments(ListQuery query, int firstResult)
          Deprecated. since 2.8, use com.atlassian.confluence.search.smartlist.SmartListManager#search instead.
 AttachmentDao.AttachmentCopier getCopier(AttachmentManager destination)
          Retrieves a AttachmentDao.AttachmentCopier that will allow the attachments from one data store to be copied across to another.
 java.util.List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject content)
          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, java.lang.String newFileName, ContentEntityObject newContent)
           
 void removeAttachmentFromServer(Attachment latestVersion)
          Removes the attachment and all previous versions
protected  void saveNewAttachment(Attachment attachment, java.io.InputStream attachmentData)
           
protected  void saveNewAttachmentVersion(Attachment attachment, Attachment previousVersion, java.io.InputStream attachmentData)
           
 void setAttachmentDao(AttachmentDao attachmentDao)
           
 void setAttachmentData(Attachment attachment, java.io.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, removeAttachments, saveAttachment, setEventManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAttachmentManager

public DefaultAttachmentManager()
Method Detail

getAttachmentData

public java.io.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,
                                 java.io.InputStream attachmentData)
                          throws java.io.IOException
Specified by:
saveNewAttachment in class AbstractAttachmentManager
Throws:
java.io.IOException

saveNewAttachmentVersion

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

getLatestVersionsOfAttachments

public java.util.List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject content)
Description copied from interface: AttachmentManager
Returns a list of only latest versions of attachments.


getAttachments

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


getAttachments

public java.util.List getAttachments(ListQuery query,
                                     int firstResult)
Deprecated. since 2.8, use com.atlassian.confluence.search.smartlist.SmartListManager#search instead.


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,
                           java.lang.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,
                              java.io.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 java.util.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)


Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.