ReadThroughCachingAttachmentManager
@Deprecated public class CachingAttachmentManager extends Object implements AttachmentManagerInternal, DelegatingAttachmentManager
Constructor and Description |
---|
CachingAttachmentManager(AttachmentManagerInternal delegate,
AttachmentDownloadPathCache pathCache)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
copyAttachment(Attachment attachment,
ContentEntityObject destinationContent)
Deprecated.
Copy specified attachment to specified destination content.
|
void |
copyAttachments(ContentEntityObject sourceContent,
ContentEntityObject destinationContent)
Deprecated.
Copy the latest version of all the attachments on the sourceContent to the destinationContent.
|
void |
copyAttachments(ContentEntityObject sourceContent,
ContentEntityObject destinationContent,
SaveContext saveContext)
Deprecated.
Copy the latest version of all the attachments on the sourceContent to the destinationContent.
|
int |
countLatestVersionsOfAttachments(ContentEntityObject content)
Deprecated.
Returns a count of the number of latest versions of attachments
|
int |
countLatestVersionsOfAttachmentsOnPageSince(ContentEntityObject content,
Date since)
Deprecated.
Fetches number of attachments changed on a page since a specific timestamp
|
int |
countLatestVersionsOfAttachmentsWithAnyStatus(ContentEntityObject content)
Deprecated.
Returns a count of the number of latest versions of attachments (including trashed)
|
List<Attachment> |
getAllVersions(Attachment attachment)
Deprecated.
Get all versions of an attachment, starting with the current version
|
List<Attachment> |
getAllVersionsOfAttachments(ContentEntityObject content)
Deprecated.
Returns a list of all attachments, old and new.
|
Attachment |
getAttachment(ContentEntityObject content,
String attachmentFileName)
Deprecated.
Get the most recent version of an attachment with a given name for a particular page
|
Attachment |
getAttachment(ContentEntityObject content,
String attachmentFileName,
int version)
Deprecated.
Retrieve a named attachment from a page
|
Attachment |
getAttachment(long id)
Deprecated.
|
AttachmentDao |
getAttachmentDao()
Deprecated.
Retrieves the AttachmentDao for the AttachmentManager
|
InputStream |
getAttachmentData(Attachment attachment)
Deprecated.
Retrieve the data for attachment
|
InputStream |
getAttachmentData(Attachment attachment,
Optional<RangeRequest> range)
Deprecated.
Retrieve the specified range of data for attachment
|
String |
getAttachmentDownloadPath(ContentEntityObject content,
String attachmentFileName)
Deprecated.
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(String downloadPath)
Deprecated.
since 7.0.1. Use
AttachmentManager.findAttachmentForDownloadPath(String) |
AttachmentManager |
getAttachmentManager()
Deprecated.
Return the AttachmentManager implementation that the delegator wraps
|
PageResponse<Attachment> |
getAttachments(ContentEntityObject content,
LimitedRequest pageRequest,
com.google.common.base.Predicate<? super Attachment> filterPredicate)
Deprecated.
|
List<Attachment> |
getAttachments(List<Long> ids)
Deprecated.
Returns a list of attachments matching the given list of IDs.
|
Optional<AttachmentStatisticsDTO> |
getAttachmentStatistics()
Deprecated.
Fetches statistics about attachments
|
AttachmentDataStorageType |
getBackingStorageType()
Deprecated.
Returns the currently active storage type.
|
AttachmentDao.AttachmentCopier |
getCopier(AttachmentManager destination)
Deprecated.
Retrieves a AttachmentDao.AttachmentCopier that will allow the attachments from
one data store to be copied across to another.
|
List<Attachment> |
getLastAddedVersionsOf(Attachment attachment)
Deprecated.
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.
|
List<Attachment> |
getLatestVersionsOfAttachments(ContentEntityObject content)
Deprecated.
Returns a list of only latest versions of attachments.
|
List<Attachment> |
getLatestVersionsOfAttachmentsForMultipleCeos(Iterable<? extends ContentEntityObject> contentEntityObjects)
Deprecated.
Returns a list of all the latest versions of attachments for all the CEOs provided
|
List<Attachment> |
getLatestVersionsOfAttachmentsWithAnyStatus(ContentEntityObject content)
Deprecated.
Returns a list of only latest versions of attachments (including trashed).
|
List<Attachment> |
getLatestVersionsOfAttachmentsWithAnyStatusForContainers(Iterable<? extends ContentEntityObject> contentEntityObjects)
Deprecated.
Returns a list of all the latest versions of attachments for all the CEOs provided (including trashed)
|
AttachmentDao.AttachmentMigrator |
getMigrator(AttachmentManager destination)
Deprecated.
Retrieves a AttachmentDao.AttachmentMigrator that will allow the attachments from
one data store to be moved across to another.
|
List<Attachment> |
getPreviousVersions(Attachment attachment)
Deprecated.
Get all non-current versions of an attachment, not including the current
version.
|
Map<Long,Long> |
getRemappedAttachmentIds()
Deprecated.
Gets a list of remapped attachment IDs.
|
void |
moveAttachment(Attachment latestVersion,
ContentEntityObject newContainer)
Deprecated.
Moves an attachment to a different
ContentEntityObject container. |
void |
moveAttachment(Attachment latestVersion,
String fileName,
ContentEntityObject newContent)
Deprecated.
|
void |
removeAttachmentFromServer(Attachment attachment)
Deprecated.
Removes an Attachment and its data from the server and data store.
|
void |
removeAttachments(List<? extends Attachment> attachments)
Deprecated.
Removes the contents of attachments from the server
|
void |
removeAttachmentVersionFromServer(Attachment attachment)
Deprecated.
Removes the given version of the Attachment and its data from the server and data store.
|
void |
removeAttachmentWithoutNotifications(Attachment attachment)
Deprecated.
Removes an Attachment and its data from the server while suppressing notifications.
|
void |
restore(Attachment attachment)
Deprecated.
Restores an attachment from trash.
|
void |
saveAttachment(Attachment attachment,
Attachment previousVersion,
InputStream attachmentData)
Deprecated.
Saves an Attachment and its data
|
void |
saveAttachment(Attachment attachment,
@Nullable Attachment previousVersion,
InputStream attachmentData,
SaveContext saveContext)
Deprecated.
Saves an Attachment and its data, taking a
SaveContext to allow
more useful event handling. |
void |
saveAttachments(List<SavableAttachment> savableAttachments)
Deprecated.
Saves multiple attachment and their data
|
void |
saveAttachments(List<SavableAttachment> savableAttachments,
SaveContext saveContext)
Deprecated.
Saves multiple attachment and their data
|
void |
setAttachmentData(Attachment attachment,
InputStream attachmentData)
Deprecated.
Set the data belonging to attachment
|
void |
trash(Attachment attachment)
Deprecated.
Moves an attachment to the trash.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFilteredAttachments
findAttachmentForDownloadPath
public CachingAttachmentManager(AttachmentManagerInternal delegate, AttachmentDownloadPathCache pathCache)
public Attachment getAttachment(long id)
getAttachment
in interface AttachmentManager
public List<Attachment> getAttachments(List<Long> ids)
AttachmentManager
getAttachments
in interface AttachmentManager
ids
- list of IDs to retrieve.public List<Attachment> getAllVersionsOfAttachments(ContentEntityObject content)
AttachmentManager
getAllVersionsOfAttachments
in interface AttachmentManager
public List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject content)
AttachmentManager
getLatestVersionsOfAttachments
in interface AttachmentManager
public List<Attachment> getLatestVersionsOfAttachmentsForMultipleCeos(Iterable<? extends ContentEntityObject> contentEntityObjects)
AttachmentManager
getLatestVersionsOfAttachmentsForMultipleCeos
in interface AttachmentManager
public List<Attachment> getLatestVersionsOfAttachmentsWithAnyStatus(ContentEntityObject content)
AttachmentManager
getLatestVersionsOfAttachmentsWithAnyStatus
in interface AttachmentManager
public List<Attachment> getLatestVersionsOfAttachmentsWithAnyStatusForContainers(Iterable<? extends ContentEntityObject> contentEntityObjects)
AttachmentManagerInternal
getLatestVersionsOfAttachmentsWithAnyStatusForContainers
in interface AttachmentManagerInternal
@Deprecated public PageResponse<Attachment> getAttachments(ContentEntityObject content, LimitedRequest pageRequest, com.google.common.base.Predicate<? super Attachment> filterPredicate)
AttachmentManagerInternal.getFilteredAttachments(ContentEntityObject, LimitedRequest, java.util.function.Predicate)
}AttachmentManagerInternal
getAttachments
in interface AttachmentManagerInternal
content
- the content to return attachments forpageRequest
- the pagination requestedfilterPredicate
- the predicate for filtering found attachmentspublic int countLatestVersionsOfAttachments(ContentEntityObject content)
AttachmentManager
countLatestVersionsOfAttachments
in interface AttachmentManager
public int countLatestVersionsOfAttachmentsWithAnyStatus(ContentEntityObject content)
AttachmentManager
countLatestVersionsOfAttachmentsWithAnyStatus
in interface AttachmentManager
public int countLatestVersionsOfAttachmentsOnPageSince(ContentEntityObject content, Date since)
AttachmentManager
countLatestVersionsOfAttachmentsOnPageSince
in interface AttachmentManager
content
- the content objectsince
- the date of earliest changepublic Optional<AttachmentStatisticsDTO> getAttachmentStatistics()
AttachmentManager
getAttachmentStatistics
in interface AttachmentManager
public InputStream getAttachmentData(Attachment attachment)
AttachmentManager
getAttachmentData
in interface AttachmentManager
attachment
- the Attachment the data belongs topublic InputStream getAttachmentData(Attachment attachment, Optional<RangeRequest> range)
AttachmentManager
getAttachmentData
in interface AttachmentManager
attachment
- the Attachment the data belongs torange
- the range of data to retrieve. See ByteRanges
public void removeAttachmentWithoutNotifications(Attachment attachment)
AttachmentManager
removeAttachmentWithoutNotifications
in interface AttachmentManager
public void removeAttachmentFromServer(Attachment attachment)
AttachmentManager
removeAttachmentFromServer
in interface AttachmentManager
attachment
- the Attachment to removepublic void removeAttachmentVersionFromServer(Attachment attachment)
AttachmentManager
In 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 AttachmentManager
attachment
- the Attachment to removepublic void removeAttachments(List<? extends Attachment> attachments)
AttachmentManager
removeAttachments
in interface AttachmentManager
attachments
- a List of AttachmentsAttachmentManager.removeAttachmentFromServer(Attachment)
public void moveAttachment(Attachment latestVersion, String fileName, ContentEntityObject newContent)
moveAttachment
in interface AttachmentManager
latestVersion
- The attachment to be movedfileName
- New name of the filenewContent
- The new contentEntiityObject which will be parent to the attachmentpublic void moveAttachment(Attachment latestVersion, ContentEntityObject newContainer)
AttachmentManagerInternal
ContentEntityObject
container.moveAttachment
in interface AttachmentManagerInternal
latestVersion
- The attachment to be movednewContainer
- The new ContentEntiityObject which will be parent to the attachmentpublic void copyAttachments(ContentEntityObject sourceContent, ContentEntityObject destinationContent) throws IOException
AttachmentManager
copyAttachments
in interface AttachmentManager
sourceContent
- the content with attachments to be copied.destinationContent
- the content to copy the attachments to.IOException
- if there are problems reading or writing attachment data during the copy.public void copyAttachments(ContentEntityObject sourceContent, ContentEntityObject destinationContent, SaveContext saveContext) throws IOException
AttachmentManager
copyAttachments
in interface AttachmentManager
sourceContent
- the content with attachments to be copied.destinationContent
- the content to copy the attachments to.saveContext
- details the circumstances under which the attachments are being copied.IOException
- if there are problems reading or writing attachment data during the copy.public void copyAttachment(Attachment attachment, ContentEntityObject destinationContent) throws IOException
AttachmentManager
copyAttachment
in interface AttachmentManager
attachment
- the attachmentdestinationContent
- the destinationIOException
public Attachment getAttachment(ContentEntityObject content, String attachmentFileName, int version)
AttachmentManager
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 insteadpublic Attachment getAttachment(ContentEntityObject content, String attachmentFileName)
AttachmentManager
getAttachment
in interface AttachmentManager
content
- the page the attachment is attached toattachmentFileName
- the filename of the attachment to be retrievedpublic String getAttachmentDownloadPath(ContentEntityObject content, String attachmentFileName)
AttachmentManager
getAttachmentDownloadPath
in interface AttachmentManager
content
- the content the attachment is attached toattachmentFileName
- the filename of the attachment to be retrievedpublic void saveAttachment(Attachment attachment, @Nullable Attachment previousVersion, InputStream attachmentData, SaveContext saveContext) throws IOException
AttachmentManager
SaveContext
to allow
more useful event handling.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 AttachmentsaveContext
- provides more information about the circumstances of the saveIOException
public void saveAttachment(Attachment attachment, Attachment previousVersion, InputStream attachmentData) throws 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 AttachmentIOException
public void saveAttachments(List<SavableAttachment> savableAttachments, SaveContext saveContext) throws IOException
AttachmentManager
saveAttachments
in interface AttachmentManager
savableAttachments
- the modified version of the AttachmentsaveContext
- provides more details about saving. If in doubt pass DefaultSaveContext.DEFAULT
.IOException
public void saveAttachments(List<SavableAttachment> savableAttachments) throws IOException
AttachmentManager
saveAttachments
in interface AttachmentManager
savableAttachments
- the modified version of the AttachmentIOException
public void setAttachmentData(Attachment attachment, InputStream attachmentData) throws AttachmentDataExistsException
AttachmentManager
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.
setAttachmentData
in interface AttachmentManager
attachment
- Attachment the data belongs toattachmentData
- the data to be savedAttachmentDataExistsException
- if data for attachment already existspublic AttachmentDao.AttachmentMigrator getMigrator(AttachmentManager destination)
AttachmentManager
getMigrator
in interface AttachmentManager
destination
- the AttachmentManager the data is being moved topublic AttachmentDao.AttachmentCopier getCopier(AttachmentManager destination)
AttachmentManager
getCopier
in interface AttachmentManager
destination
- the AttachmentManager the data is being copied topublic AttachmentDao getAttachmentDao()
AttachmentManager
getAttachmentDao
in interface AttachmentManager
public List<Attachment> getAllVersions(Attachment attachment)
AttachmentManager
getAllVersions
in interface AttachmentManager
public List<Attachment> getPreviousVersions(Attachment attachment)
AttachmentManager
getPreviousVersions
in interface AttachmentManager
attachment
- the attachment to get all non-current versions for.public List<Attachment> getLastAddedVersionsOf(Attachment attachment)
AttachmentManager
getLastAddedVersionsOf
in interface AttachmentManager
attachment
- attachment (must be the latest version)public AttachmentDataStorageType getBackingStorageType()
AttachmentManager
getBackingStorageType
in interface AttachmentManager
AttachmentDao.getBackingStorageType()
public void trash(Attachment attachment)
AttachmentManager
trash
in interface AttachmentManager
attachment
- the attachment to be trashedpublic void restore(Attachment attachment)
AttachmentManager
restore
in interface AttachmentManager
attachment
- the attachment to restore@Deprecated public com.atlassian.fugue.Maybe<Attachment> getAttachmentForDownloadPath(String downloadPath)
AttachmentManager.findAttachmentForDownloadPath(String)
AttachmentManager
Attachment
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 AttachmentManager
downloadPath
- 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
public Map<Long,Long> getRemappedAttachmentIds()
AttachmentManager
getRemappedAttachmentIds
in interface AttachmentManager
Copyright © 2003–2021 Atlassian. All rights reserved.