com.atlassian.confluence.pages
Class AbstractAttachmentManager

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

public abstract class AbstractAttachmentManager
extends Object
implements AttachmentManager


Constructor Summary
AbstractAttachmentManager()
           
 
Method Summary
 Attachment getAttachment(ContentEntityObject content, String attachmentFileName)
          Get the most recent version of an attachment with a given name for a particular page
 Attachment getAttachment(ContentEntityObject content, String attachmentFileName, int version)
          Retrieve a named attachment from a page
 List getPreviousVersions(Attachment attachment)
          Get all non-current versions of an attachment, not including the current version.
 ThumbnailManager getThumbnailManager()
           
 void removeAttachments(List attachments)
          Removes the contents of attachments from the server
protected  void removeThumbnail(Attachment attachment)
           
 void saveAttachment(Attachment attachment, Attachment previousVersion, InputStream attachmentData)
          Saves an Attachment and its data
protected abstract  void saveNewAttachment(Attachment attachment, InputStream attachmentData)
           
protected abstract  void saveNewAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream attachmentData)
           
 void setThumbnailManager(ThumbnailManager thumbnailManager)
           
 
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.pages.AttachmentManager
getAllVersions, getAttachmentDao, getAttachmentData, getAttachments, getAttachments, getCopier, getLatestVersionsOfAttachments, getMigrator, moveAttachment, removeAttachmentFromServer, setAttachmentData
 

Constructor Detail

AbstractAttachmentManager

public AbstractAttachmentManager()
Method Detail

getAttachment

public Attachment getAttachment(ContentEntityObject content,
                                String attachmentFileName)
Get the most recent version of an attachment with a given name for a particular page

Specified by:
getAttachment in interface AttachmentManager
Parameters:
content - the page the attachment is attached to
attachmentFileName - the filename of the attachment to be retrieved
Returns:
the appropriate attachment, or null if no such attachment exists

getAttachment

public Attachment getAttachment(ContentEntityObject content,
                                String attachmentFileName,
                                int version)
Retrieve a named attachment from a page

Specified by:
getAttachment in interface AttachmentManager
Parameters:
content - the page the attachment is attached to
attachmentFileName - the filename of the attachment to retrieve
version - the version of the attachment to retrieve. If you provide a version of 0 or less, you'll get the most recent version, but you should probably use #getAttachment(AbstractPage, String) instead for that purpose instead
Returns:
the requested attachment, or null if the requested attachment does not exist.

saveAttachment

public void saveAttachment(Attachment attachment,
                           Attachment previousVersion,
                           InputStream attachmentData)
                    throws IOException
Description copied from interface: AttachmentManager
Saves an Attachment and its data

Specified by:
saveAttachment in interface AttachmentManager
Parameters:
attachment - the modified version of the Attachment
previousVersion - the original version of the Attachment (null if new)
attachmentData - an InputStream representing the data of the Attachment
Throws:
IOException

removeThumbnail

protected void removeThumbnail(Attachment attachment)

getThumbnailManager

public ThumbnailManager getThumbnailManager()

setThumbnailManager

public void setThumbnailManager(ThumbnailManager thumbnailManager)

saveNewAttachment

protected abstract void saveNewAttachment(Attachment attachment,
                                          InputStream attachmentData)
                                   throws IOException
Throws:
IOException

saveNewAttachmentVersion

protected abstract void saveNewAttachmentVersion(Attachment attachment,
                                                 Attachment previousVersion,
                                                 InputStream attachmentData)
                                          throws IOException
Throws:
IOException

removeAttachments

public void removeAttachments(List attachments)
Description copied from interface: AttachmentManager
Removes the contents of attachments from the server

Specified by:
removeAttachments in interface AttachmentManager
Parameters:
attachments - a List of Attachments
See Also:
AttachmentManager.removeAttachmentFromServer(Attachment)

getPreviousVersions

public List getPreviousVersions(Attachment attachment)
Description copied from interface: AttachmentManager
Get all non-current versions of an attachment, not including the current version. (ordered from most recent)

Specified by:
getPreviousVersions in interface AttachmentManager
Parameters:
attachment - the attachment to get all non-current versions for.


Confluence is developed by Atlassian.