com.atlassian.confluence.pages
Class AbstractAttachmentManager

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

public abstract class AbstractAttachmentManager
extends java.lang.Object
implements AttachmentManager


Field Summary
protected  com.atlassian.event.EventManager eventManager
           
 
Constructor Summary
AbstractAttachmentManager()
           
 
Method Summary
 Attachment getAttachment(ContentEntityObject content, java.lang.String attachmentFileName)
          Get the most recent version of an attachment with a given name for a particular page
 Attachment getAttachment(ContentEntityObject content, java.lang.String attachmentFileName, int version)
          Retrieve a named attachment from a page
 java.util.List getPreviousVersions(Attachment attachment)
          Get all non-current versions of an attachment, not including the current version.
 void removeAttachments(java.util.List attachments)
          Removes the contents of attachments from the server
 void saveAttachment(Attachment attachment, Attachment previousVersion, java.io.InputStream attachmentData)
          Saves an Attachment and its data
protected abstract  void saveNewAttachment(Attachment attachment, java.io.InputStream attachmentData)
           
protected abstract  void saveNewAttachmentVersion(Attachment attachment, Attachment previousVersion, java.io.InputStream attachmentData)
           
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
 
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
 

Field Detail

eventManager

protected com.atlassian.event.EventManager eventManager
Constructor Detail

AbstractAttachmentManager

public AbstractAttachmentManager()
Method Detail

getAttachment

public Attachment getAttachment(ContentEntityObject content,
                                java.lang.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,
                                java.lang.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,
                           java.io.InputStream attachmentData)
                    throws java.io.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:
java.io.IOException

saveNewAttachment

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

saveNewAttachmentVersion

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

removeAttachments

public void removeAttachments(java.util.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 java.util.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.

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)


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