|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.pages.CachingAttachmentManager
public class CachingAttachmentManager
Caches the download paths of attachments.
| Constructor Summary | |
|---|---|
CachingAttachmentManager(AttachmentManagerInternal delegate,
AttachmentDownloadPathCache pathCache)
|
|
| Method Summary | |
|---|---|
void |
copyAttachment(Attachment attachment,
ContentEntityObject destinationContent)
Copy specified attachment to specified destination content. |
void |
copyAttachments(ContentEntityObject sourceContent,
ContentEntityObject destinationContent)
Copy the latest version of all the attachments on the sourceContent to the destinationContent. |
int |
countLatestVersionsOfAttachments(ContentEntityObject content)
Returns a count of the number of latest versions of attachments |
java.util.List<Attachment> |
getAllVersions(Attachment attachment)
Get all versions of an attachment, starting with the current version |
java.util.List<Attachment> |
getAllVersionsOfAttachments(ContentEntityObject content)
Returns a list of all attachments, old and new. |
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 |
Attachment |
getAttachment(long id)
|
AttachmentDao |
getAttachmentDao()
Retrieves the AttachmentDao for the AttachmentManager |
java.io.InputStream |
getAttachmentData(Attachment attachment)
Retrieve the data for attachment |
java.lang.String |
getAttachmentDownloadPath(ContentEntityObject content,
java.lang.String attachmentFileName)
Get the download path for the most recent version of an attachment with the given name for some content |
com.atlassian.fugue.Maybe<Attachment> |
getAttachmentForDownloadPath(java.lang.String downloadPath)
Find an Attachment for the given downloadPath. |
AttachmentManager |
getAttachmentManager()
Return the AttachmentManager implementation that the delegator wraps |
java.util.List<Attachment> |
getAttachments(ContentEntityObject content)
Returns a list of all attachments, old and new. |
PageResponse<Attachment> |
getAttachments(ContentEntityObject content,
LimitedRequest pageRequest,
com.google.common.base.Predicate<? super Attachment> filterPredicate)
Returns the current attachments under the CEO. |
AttachmentDataStorageType |
getBackingStorageType()
Returns the currently active storage type. |
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,
ContentEntityObject newContainer)
Moves an attachment to a different ContentEntityObject container. |
void |
moveAttachment(Attachment latestVersion,
java.lang.String fileName,
ContentEntityObject newContent)
|
void |
removeAttachmentFromServer(Attachment attachment)
Removes an Attachment and its data from the server and data store. |
void |
removeAttachments(java.util.List<? extends Attachment> attachments)
Removes the contents of attachments from the server |
void |
removeAttachmentVersionFromServer(Attachment attachment)
Removes the given version of the Attachment and its data from the server and data store. |
void |
saveAttachment(Attachment attachment,
Attachment previousVersion,
java.io.InputStream attachmentData)
Saves an Attachment and its data |
void |
saveAttachments(java.util.List<SavableAttachment> savableAttachments)
Saves multiple attachment and their data |
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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CachingAttachmentManager(AttachmentManagerInternal delegate,
AttachmentDownloadPathCache pathCache)
| Method Detail |
|---|
public Attachment getAttachment(long id)
getAttachment in interface AttachmentManagerpublic java.util.List<Attachment> getAttachments(ContentEntityObject content)
AttachmentManager
getAttachments in interface AttachmentManagerpublic java.util.List<Attachment> getAllVersionsOfAttachments(ContentEntityObject content)
AttachmentManager
getAllVersionsOfAttachments in interface AttachmentManagerpublic java.util.List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject content)
AttachmentManager
getLatestVersionsOfAttachments in interface AttachmentManager
public PageResponse<Attachment> getAttachments(ContentEntityObject content,
LimitedRequest pageRequest,
com.google.common.base.Predicate<? super Attachment> filterPredicate)
AttachmentManagerInternal
Note - only returns the latest versions of the Attachments. The legacy
AttachmentManager.getAttachments(ContentEntityObject) method
that confusingly returns all versions has been deprecated.
getAttachments in interface AttachmentManagerInternalcontent - the content to return attachments forpageRequest - the pagination requestedfilterPredicate - the predicate for filtering found attachments
public int countLatestVersionsOfAttachments(ContentEntityObject content)
AttachmentManager
countLatestVersionsOfAttachments in interface AttachmentManagerpublic java.io.InputStream getAttachmentData(Attachment attachment)
AttachmentManager
getAttachmentData in interface AttachmentManagerattachment - the Attachment the data belongs to
public void removeAttachmentFromServer(Attachment attachment)
AttachmentManager
removeAttachmentFromServer in interface AttachmentManagerattachment - the Attachment to removepublic void removeAttachmentVersionFromServer(Attachment attachment)
AttachmentManagerIn case of the given attachment being the latest version, the previous version (if any) gets removed and the given object impersonates the previous version as the latest version.
removeAttachmentVersionFromServer in interface AttachmentManagerattachment - the Attachment to removepublic void removeAttachments(java.util.List<? extends Attachment> attachments)
AttachmentManager
removeAttachments in interface AttachmentManagerattachments - a List of AttachmentsAttachmentManager.removeAttachmentFromServer(Attachment)
public void moveAttachment(Attachment latestVersion,
java.lang.String fileName,
ContentEntityObject newContent)
moveAttachment in interface AttachmentManagerlatestVersion - The attachment to be movedfileName - New name of the filenewContent - The new contentEntiityObject which will be parent to the attachment
public void moveAttachment(Attachment latestVersion,
ContentEntityObject newContainer)
AttachmentManagerInternalContentEntityObject container.
moveAttachment in interface AttachmentManagerInternallatestVersion - The attachment to be movednewContainer - The new ContentEntiityObject which will be parent to the attachment
public void copyAttachments(ContentEntityObject sourceContent,
ContentEntityObject destinationContent)
throws java.io.IOException
AttachmentManager
copyAttachments in interface AttachmentManagersourceContent - the content with attachments to be copied.destinationContent - the content to copy the attachments to.
java.io.IOException - if there are problems reading or writing attachment data during the copy.
public void copyAttachment(Attachment attachment,
ContentEntityObject destinationContent)
throws java.io.IOException
AttachmentManager
copyAttachment in interface AttachmentManagerattachment - the attachmentdestinationContent - the destination
java.io.IOException
public Attachment getAttachment(ContentEntityObject content,
java.lang.String attachmentFileName,
int version)
AttachmentManager
getAttachment in interface AttachmentManagercontent - 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 Attachment getAttachment(ContentEntityObject content,
java.lang.String attachmentFileName)
AttachmentManager
getAttachment in interface AttachmentManagercontent - the page the attachment is attached toattachmentFileName - the filename of the attachment to be retrieved
public java.lang.String getAttachmentDownloadPath(ContentEntityObject content,
java.lang.String attachmentFileName)
AttachmentManager
getAttachmentDownloadPath in interface AttachmentManagercontent - the content the attachment is attached toattachmentFileName - the filename of the attachment to be retrieved
public void saveAttachment(Attachment attachment,
Attachment previousVersion,
java.io.InputStream attachmentData)
throws java.io.IOException
AttachmentManager
saveAttachment in interface AttachmentManagerattachment - 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 saveAttachments(java.util.List<SavableAttachment> savableAttachments)
throws java.io.IOException
AttachmentManager
saveAttachments in interface AttachmentManagersavableAttachments - the modified version of the Attachment
java.io.IOException
public void setAttachmentData(Attachment attachment,
java.io.InputStream attachmentData)
throws AttachmentDataExistsException
AttachmentManager
setAttachmentData in interface AttachmentManagerattachment - 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 AttachmentManagerdestination - the AttachmentManager the data is being moved to
public AttachmentDao.AttachmentCopier getCopier(AttachmentManager destination)
AttachmentManager
getCopier in interface AttachmentManagerdestination - the AttachmentManager the data is being copied to
public AttachmentDao getAttachmentDao()
AttachmentManager
getAttachmentDao in interface AttachmentManagerpublic java.util.List<Attachment> getAllVersions(Attachment attachment)
AttachmentManager
getAllVersions in interface AttachmentManagerpublic java.util.List<Attachment> getPreviousVersions(Attachment attachment)
AttachmentManager
getPreviousVersions in interface AttachmentManagerattachment - the attachment to get all non-current versions for.public java.util.List<Attachment> getLastAddedVersionsOf(Attachment attachment)
AttachmentManager
getLastAddedVersionsOf in interface AttachmentManagerattachment - attachment (must be the latest version)
public AttachmentDataStorageType getBackingStorageType()
AttachmentManager
getBackingStorageType in interface AttachmentManagerAttachmentDao.getBackingStorageType()public com.atlassian.fugue.Maybe<Attachment> getAttachmentForDownloadPath(java.lang.String downloadPath)
AttachmentManagerAttachment for the given downloadPath.
The path must at least contain the segment produced by Attachment.getDownloadPath(), that
is /download/attachments/<contentId>/<fileName> where <contentId> identifies a valid
ContentEntityObject and <fileName> identifies a valid Attachment attached to that
ContentEntityObject.
getAttachmentForDownloadPath in interface AttachmentManagerdownloadPath - the download path identifying an Attachment.This value is expected to be url encoded,
with spaces converted to %20 instead of a '+'
Attachment.getDownloadPath()public AttachmentManager getAttachmentManager()
DelegatingAttachmentManager
getAttachmentManager in interface DelegatingAttachmentManager
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||