|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.confluence.pages.DefaultAttachmentManager
public class DefaultAttachmentManager
Default implementation of AttachmentManager
. The storage location of attachments
is not defined, and is handled by the AttachmentDao.
Constructor Summary | |
---|---|
DefaultAttachmentManager()
|
Method Summary | |
---|---|
java.util.List<Attachment> |
getAllVersions(Attachment attachment)
Get all versions of an attachment, starting with the current version |
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 |
AttachmentDao |
getAttachmentDao()
Retrieves the AttachmentDao for the AttachmentManager |
java.io.InputStream |
getAttachmentData(Attachment attachment)
Retrieve the data for attachment |
java.util.List<Attachment> |
getAttachments(ContentEntityObject content)
Returns a list of all attachments, old and new. |
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> |
getLastAddedVersionsOf(Attachment attachment)
Retrieves all the last added versions for each user who has added a version of the attachment That is, if a user has added multiple versions, only the latest added version will be added to the list returned. |
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. |
java.util.List<Attachment> |
getPreviousVersions(Attachment attachment)
Get all non-current versions of an attachment, not including the current version. |
void |
moveAttachment(Attachment latestVersion,
java.lang.String newFileName,
ContentEntityObject newContent)
|
void |
removeAttachmentFromServer(Attachment latestVersion)
Removes the attachment and all previous versions |
void |
removeAttachments(java.util.List<? extends Attachment> 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 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. |
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 |
Constructor Detail |
---|
public DefaultAttachmentManager()
Method Detail |
---|
public Attachment getAttachment(ContentEntityObject content, java.lang.String attachmentFileName)
getAttachment
in interface AttachmentManager
content
- the page the attachment is attached toattachmentFileName
- the filename of the attachment to be retrieved
public Attachment getAttachment(ContentEntityObject content, java.lang.String attachmentFileName, int version)
getAttachment
in interface AttachmentManager
content
- the page the attachment is attached toattachmentFileName
- the filename of the attachment to retrieveversion
- 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
public void saveAttachment(Attachment attachment, Attachment previousVersion, java.io.InputStream attachmentData) throws java.io.IOException
AttachmentManager
saveAttachment
in interface AttachmentManager
attachment
- the modified version of the AttachmentpreviousVersion
- the original version of the Attachment (null if new)attachmentData
- an InputStream representing the data of the Attachment
java.io.IOException
public void removeAttachments(java.util.List<? extends Attachment> attachments)
AttachmentManager
removeAttachments
in interface AttachmentManager
attachments
- a List of AttachmentsAttachmentManager.removeAttachmentFromServer(Attachment)
public java.util.List<Attachment> getPreviousVersions(Attachment attachment)
AttachmentManager
getPreviousVersions
in interface AttachmentManager
attachment
- the attachment to get all non-current versions for.public java.util.List<Attachment> getLastAddedVersionsOf(Attachment attachment)
AttachmentManager
getLastAddedVersionsOf
in interface AttachmentManager
attachment
- attachment (must be the latest version)
public java.io.InputStream getAttachmentData(Attachment attachment)
AttachmentManager
getAttachmentData
in interface AttachmentManager
attachment
- the Attachment the data belongs to
protected void saveNewAttachment(Attachment attachment, java.io.InputStream attachmentData) throws java.io.IOException
java.io.IOException
protected void saveNewAttachmentVersion(Attachment attachment, Attachment previousVersion, java.io.InputStream attachmentData) throws java.io.IOException
java.io.IOException
public java.util.List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject content)
AttachmentManager
getLatestVersionsOfAttachments
in interface AttachmentManager
public java.util.List<Attachment> getAttachments(ContentEntityObject content)
AttachmentManager
getAttachments
in interface AttachmentManager
public java.util.List<Attachment> getAllVersions(Attachment attachment)
AttachmentManager
getAllVersions
in interface AttachmentManager
public void removeAttachmentFromServer(Attachment latestVersion)
removeAttachmentFromServer
in interface AttachmentManager
latestVersion
- latest version of the attachment to removepublic void moveAttachment(Attachment latestVersion, java.lang.String newFileName, ContentEntityObject newContent)
moveAttachment
in interface AttachmentManager
latestVersion
- The attachment to be movednewFileName
- New name of the filenewContent
- The new contentEntiityObject which will be parent to the attachmentpublic void setAttachmentData(Attachment attachment, java.io.InputStream attachmentData) throws AttachmentDataExistsException
AttachmentManager
setAttachmentData
in interface AttachmentManager
attachment
- Attachment the data belongs toattachmentData
- the data to be saved
AttachmentDataExistsException
- if data for attachment already existspublic AttachmentDao.AttachmentMigrator getMigrator(AttachmentManager destination)
AttachmentManager
getMigrator
in interface AttachmentManager
destination
- the AttachmentManager the data is being moved to
public AttachmentDao.AttachmentCopier getCopier(AttachmentManager destination)
AttachmentManager
getCopier
in interface AttachmentManager
destination
- the AttachmentManager the data is being copied to
public AttachmentDao getAttachmentDao()
AttachmentManager
getAttachmentDao
in interface AttachmentManager
public void setAttachmentDao(AttachmentDao attachmentDao)
public void setEventManager(com.atlassian.event.EventManager eventManager)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |