Class ReadOnlyAttachmentManager

java.lang.Object
com.atlassian.confluence.pages.ReadOnlyAttachmentManager
All Implemented Interfaces:
AttachmentManager

@Deprecated(forRemoval=true) public class ReadOnlyAttachmentManager extends Object implements AttachmentManager
Deprecated, for removal: This API element is subject to removal in a future version.
since 9.1, use DefaultAttachmentManager directly.
  • Constructor Details

    • ReadOnlyAttachmentManager

      public ReadOnlyAttachmentManager(AttachmentManager delegate)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • deepAttachmentDelete

      public void deepAttachmentDelete(AttachmentDeleteOptions attachmentDeleteOptions)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Support delete multiple attachments in batch
      Specified by:
      deepAttachmentDelete in interface AttachmentManager
    • getAttachment

      public Attachment getAttachment(long id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getAttachment in interface AttachmentManager
      Returns:
      attachment with id
    • getAttachments

      public List<Attachment> getAttachments(List<Long> ids)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Returns a list of attachments matching the given list of IDs. Returns an empty list if no such attachments exist. In the case where some IDs exist and some don't, only the existing Attachments will be returned.
      Specified by:
      getAttachments in interface AttachmentManager
      Parameters:
      ids - list of IDs to retrieve.
      Returns:
      attachments matching ids in the list
    • getAllVersionsOfAttachments

      public List<Attachment> getAllVersionsOfAttachments(ContentEntityObject content)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Returns a list of all attachments, old and new.
      Specified by:
      getAllVersionsOfAttachments in interface AttachmentManager
    • getLatestVersionsOfAttachments

      public List<Attachment> getLatestVersionsOfAttachments(ContentEntityObject content)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Returns a list of only latest versions of attachments.
      Specified by:
      getLatestVersionsOfAttachments in interface AttachmentManager
    • getLatestVersionsOfAttachmentsForMultipleCeos

      public List<Attachment> getLatestVersionsOfAttachmentsForMultipleCeos(Iterable<? extends ContentEntityObject> contentEntityObjects)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Returns a list of all the latest versions of attachments for all the CEOs provided
      Specified by:
      getLatestVersionsOfAttachmentsForMultipleCeos in interface AttachmentManager
    • getLatestVersionsOfAttachmentsWithAnyStatus

      public List<Attachment> getLatestVersionsOfAttachmentsWithAnyStatus(ContentEntityObject content)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Returns a list of only latest versions of attachments (including trashed).
      Specified by:
      getLatestVersionsOfAttachmentsWithAnyStatus in interface AttachmentManager
    • countLatestVersionsOfAttachments

      public int countLatestVersionsOfAttachments(ContentEntityObject content)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Returns a count of the number of latest versions of attachments
      Specified by:
      countLatestVersionsOfAttachments in interface AttachmentManager
    • countLatestVersionsOfAttachmentsWithAnyStatus

      public int countLatestVersionsOfAttachmentsWithAnyStatus(ContentEntityObject content)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Returns a count of the number of latest versions of attachments (including trashed)
      Specified by:
      countLatestVersionsOfAttachmentsWithAnyStatus in interface AttachmentManager
    • countLatestVersionsOfAttachmentsOnPageSince

      public int countLatestVersionsOfAttachmentsOnPageSince(ContentEntityObject content, Date since)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Fetches number of attachments changed on a page since a specific timestamp
      Specified by:
      countLatestVersionsOfAttachmentsOnPageSince in interface AttachmentManager
      Parameters:
      content - the content object
      since - the date of earliest change
      Returns:
      the number of attachments on a content object (including trashed) changed since
    • getAttachmentStatistics

      public Optional<AttachmentStatisticsDTO> getAttachmentStatistics()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Fetches statistics about attachments
      Specified by:
      getAttachmentStatistics in interface AttachmentManager
      Returns:
      an AttachmentStatisticsDTO object with statistics about attachments such as total and current count
    • getAttachmentData

      public InputStream getAttachmentData(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Retrieve the data for attachment
      Specified by:
      getAttachmentData in interface AttachmentManager
      Parameters:
      attachment - the Attachment the data belongs to
      Returns:
      InputStream representing the data
    • getAttachmentData

      public InputStream getAttachmentData(Attachment attachment, Optional<RangeRequest> range)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Retrieve the specified range of data for attachment
      Specified by:
      getAttachmentData in interface AttachmentManager
      Parameters:
      attachment - the Attachment the data belongs to
      range - the range of data to retrieve. See com.atlassian.filestore.client.api.entity.ByteRanges
      Returns:
      InputStream representing the data
    • removeAttachmentFromServer

      public void removeAttachmentFromServer(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Removes an Attachment and its data from the server and data store.
      Specified by:
      removeAttachmentFromServer in interface AttachmentManager
      Parameters:
      attachment - the Attachment to remove
    • removeAttachmentWithoutNotifications

      public void removeAttachmentWithoutNotifications(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Removes an Attachment and its data from the server while suppressing notifications. This is useful when you don't want to send notifications when removing the file.
      Specified by:
      removeAttachmentWithoutNotifications in interface AttachmentManager
    • removeAttachmentVersionFromServer

      public void removeAttachmentVersionFromServer(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Removes the given version of the Attachment and its data from the server and data store.

      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.

      Specified by:
      removeAttachmentVersionFromServer in interface AttachmentManager
      Parameters:
      attachment - the Attachment to remove
    • removeAttachmentVersionFromServerWithoutNotifications

      public void removeAttachmentVersionFromServerWithoutNotifications(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Removes the given version of the Attachment and its data from the server and data store while suppressing notifications. This is useful when you don't want to send notifications when removing the file.

      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.

      Specified by:
      removeAttachmentVersionFromServerWithoutNotifications in interface AttachmentManager
      Parameters:
      attachment - the Attachment to remove
    • removeAttachments

      public void removeAttachments(List<? extends Attachment> attachments)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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:
    • moveAttachment

      public void moveAttachment(Attachment latestVersion, String fileName, ContentEntityObject newContent)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      moveAttachment in interface AttachmentManager
      Parameters:
      latestVersion - The attachment to be moved
      fileName - New name of the file
      newContent - The new contentEntiityObject which will be parent to the attachment
    • copyAttachments

      public void copyAttachments(ContentEntityObject sourceContent, ContentEntityObject destinationContent, SaveContext saveContext) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Copy the latest version of all the attachments on the sourceContent to the destinationContent.
      Specified by:
      copyAttachments in interface AttachmentManager
      Parameters:
      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.
      Throws:
      IOException - if there are problems reading or writing attachment data during the copy.
    • copyAttachments

      public void copyAttachments(ContentEntityObject sourceContent, ContentEntityObject destinationContent) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Copy the latest version of all the attachments on the sourceContent to the destinationContent.
      Specified by:
      copyAttachments in interface AttachmentManager
      Parameters:
      sourceContent - the content with attachments to be copied.
      destinationContent - the content to copy the attachments to.
      Throws:
      IOException - if there are problems reading or writing attachment data during the copy.
    • copyAttachment

      public void copyAttachment(Attachment attachment, ContentEntityObject destinationContent) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Copy specified attachment to specified destination content.
      Specified by:
      copyAttachment in interface AttachmentManager
      Parameters:
      attachment - the attachment
      destinationContent - the destination
      Throws:
      IOException
    • getAttachment

      public Attachment getAttachment(ContentEntityObject content, String attachmentFileName, int version)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      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.
    • getAttachment

      public Attachment getAttachment(ContentEntityObject content, String attachmentFileName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      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
    • getAttachmentDownloadPath

      public String getAttachmentDownloadPath(ContentEntityObject content, String attachmentFileName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Get the download path for the most recent version of an attachment with the given name for some content
      Specified by:
      getAttachmentDownloadPath in interface AttachmentManager
      Parameters:
      content - the content the attachment is attached to
      attachmentFileName - the filename of the attachment to be retrieved
      Returns:
      the appropriate attachment download path, or null if no such attachment exists
    • saveAttachment

      public void saveAttachment(Attachment attachment, @Nullable Attachment previousVersion, InputStream attachmentData, SaveContext saveContext) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Saves an Attachment and its data, taking a SaveContext to allow more useful event handling.
      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
      saveContext - provides more information about the circumstances of the save
      Throws:
      IOException
    • saveAttachment

      public void saveAttachment(Attachment attachment, @Nullable Attachment previousVersion, InputStream attachmentData) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • saveAttachments

      public void saveAttachments(List<SavableAttachment> savableAttachments, SaveContext saveContext) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Saves multiple attachment and their data
      Specified by:
      saveAttachments in interface AttachmentManager
      Parameters:
      savableAttachments - the modified version of the Attachment
      saveContext - provides more details about saving. If in doubt pass DefaultSaveContext.DEFAULT.
      Throws:
      IOException
    • saveAttachments

      public void saveAttachments(List<SavableAttachment> savableAttachments) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Saves multiple attachment and their data
      Specified by:
      saveAttachments in interface AttachmentManager
      Parameters:
      savableAttachments - the modified version of the Attachment
      Throws:
      IOException
    • setAttachmentData

      public void setAttachmentData(Attachment attachment, InputStream attachmentData) throws AttachmentDataExistsException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Set the data belonging to attachment

      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.

      Specified by:
      setAttachmentData in interface AttachmentManager
      Parameters:
      attachment - Attachment the data belongs to
      attachmentData - the data to be saved
      Throws:
      AttachmentDataExistsException - if data for attachment already exists
    • getAllVersions

      public List<Attachment> getAllVersions(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Get all versions of an attachment, starting with the current version
      Specified by:
      getAllVersions in interface AttachmentManager
    • getPreviousVersions

      public List<Attachment> getPreviousVersions(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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.
    • getLastAddedVersionsOf

      public List<Attachment> getLastAddedVersionsOf(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      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. Result will be sorted with the earliest version coming first.
      Specified by:
      getLastAddedVersionsOf in interface AttachmentManager
      Parameters:
      attachment - attachment (must be the latest version)
      Returns:
      the last added versions for each user who has added a version of the attachment
    • getBackingStorageType

      public AttachmentDataStorageType getBackingStorageType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Returns the currently active storage type.
      Specified by:
      getBackingStorageType in interface AttachmentManager
      See Also:
    • findAttachmentForDownloadPath

      public Optional<Attachment> findAttachmentForDownloadPath(String downloadPath)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Find an 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.

      Specified by:
      findAttachmentForDownloadPath in interface AttachmentManager
      Parameters:
      downloadPath - the download path identifying an Attachment.This value is expected to be url encoded, with spaces converted to %20 instead of a '+'
      Returns:
      maybe the attachment if the given download path matches the criteria as described above and the referenced objects are known to the system
      See Also:
    • getRemappedAttachmentIds

      public Map<Long,Long> getRemappedAttachmentIds()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Gets a list of remapped attachment IDs. The key is the old ID and the value is the new ID.
      Specified by:
      getRemappedAttachmentIds in interface AttachmentManager
      Returns:
      A map where the key is the original ID and the value is the new ID.
    • trash

      public void trash(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Moves an attachment to the trash.
      Specified by:
      trash in interface AttachmentManager
      Parameters:
      attachment - the attachment to be trashed
    • restore

      public void restore(Attachment attachment)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AttachmentManager
      Restores an attachment from trash.
      Specified by:
      restore in interface AttachmentManager
      Parameters:
      attachment - the attachment to restore