Interface AttachmentDataDao
- All Known Subinterfaces:
- NonTransactionalAttachmentDataDao,- TransactionalAttachmentDataDao
- All Known Implementing Classes:
- FileSystemAttachmentDataDao,- FileSystemAttachmentDataDao,- HibernateAttachmentDataDao
public interface AttachmentDataDao
This interface defines the methods for classes acting as a DAO at
 the level of data storage for Attachments.
- 
Method SummaryModifier and TypeMethodDescriptiongetDataForAttachment(Attachment attachment) Deprecated.getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType) Grabs the AttachmentData object for an AttachmentgetDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range) Grabs the AttachmentData object for an AttachmentReturns the storage type.booleanisAttachmentPresent(Attachment attachment) Check that an attachment existsvoidmoveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent) Moves an attachment to a new file name or content objectvoidmoveDataForAttachmentVersion(Attachment sourceAttachmentVersion, Attachment targetAttachmentVersion) Moves the attachment data from oneAbstractVersionedEntityObject.getVersion()to the other.voidremoveDataForAttachment(Attachment attachment, ContentEntityObject originalContent) Removes all attachment data for the given attachment.voidremoveDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent) Removes the attachment data for the given attachment version.voidremoveDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent, AttachmentDataStreamType dataStreamType) Removes the attachment data of the specific stream type for the given attachment version.voidreplaceDataForAttachment(Attachment attachment, AttachmentDataStream dataStream) Sets the data for attachmentvoidreplaceDataForAttachment(Attachment attachment, InputStream data) Deprecated.voidsaveDataForAttachment(Attachment attachment, AttachmentDataStream dataStream) Saves data to the attachment data storevoidsaveDataForAttachment(Attachment attachment, InputStream data) Deprecated.voidsaveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, AttachmentDataStream dataStream) Saves data to the attachment data store, for an attachment that has been updated.voidsaveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream data) 
- 
Method Details- 
getDataForAttachment@Deprecated InputStream getDataForAttachment(Attachment attachment) throws AttachmentDataNotFoundException Deprecated.Grabs the AttachmentData object for an Attachment- Parameters:
- attachment- the Attachment representing the data
- Returns:
- an AttachmentData object
- Throws:
- IllegalArgumentException- if attachment is null
- AttachmentDataNotFoundException- if no data was found
 
- 
getDataForAttachmentAttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType) throws AttachmentDataNotFoundException Grabs the AttachmentData object for an Attachment- Parameters:
- attachment- the Attachment representing the data
- Returns:
- an AttachmentData object
- Throws:
- IllegalArgumentException- if attachment is null
- AttachmentDataNotFoundException- if no data was found
 
- 
getDataForAttachmentAttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range) throws AttachmentDataNotFoundException Grabs the AttachmentData object for an Attachment- Parameters:
- attachment- the Attachment representing the data
- dataStreamType- the stream type of attachment
- range- the range of attachment data
- Returns:
- an AttachmentData object
- Throws:
- IllegalArgumentException- if attachment is null
- AttachmentDataNotFoundException- if no data was found
 
- 
removeDataForAttachmentRemoves all attachment data for the given attachment. Since Confluence 4.2 the contract of this method has been clarified. It now removes all versions of the given attachment.- Parameters:
- attachment- the latest version of the attachment for which the data should be removed
- originalContent- the content the attachment belongs to
- Throws:
- IllegalArgumentException- if attachment is null
 
- 
removeDataForAttachmentVersionvoid removeDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent) Removes the attachment data for the given attachment version.- Parameters:
- attachmentVersion- the version of the attachment for which the data should be removed
- originalContent- the content the attachment belongs to
- Throws:
- IllegalArgumentException- if attachment is null
- Since:
- 4.3
 
- 
removeDataForAttachmentVersionvoid removeDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent, AttachmentDataStreamType dataStreamType) Removes the attachment data of the specific stream type for the given attachment version.- Parameters:
- attachmentVersion- the version of the attachment for which the data should be removed
- originalContent- the content the attachment belongs to
- dataStreamType- the data stream type
- Throws:
- IllegalArgumentException- if attachment is null
- Since:
- 6.5
 
- 
moveDataForAttachmentVersionvoid moveDataForAttachmentVersion(Attachment sourceAttachmentVersion, Attachment targetAttachmentVersion) Moves the attachment data from oneAbstractVersionedEntityObject.getVersion()to the other.This method will overwrite any existing data for the target attachment version. - Parameters:
- sourceAttachmentVersion- the attachment
- targetAttachmentVersion-
- Throws:
- IllegalArgumentException- if the- Attachment.getContainer()differs
- Since:
- 4.3
- See Also:
 
- 
saveDataForAttachmentDeprecated.Saves data to the attachment data store- Parameters:
- attachment- the Attachment the data belongs to
- data- the InputStream to be written
- Throws:
- IllegalArgumentException- if attachment is null
- IllegalArgumentException- if data is null
- AttachmentDataStreamSizeMismatchException- if bytes read from the data stream does not match- Attachment.getFileSize().
 
- 
saveDataForAttachmentSaves data to the attachment data store- Parameters:
- attachment- the Attachment the data belongs to
- dataStream- the data stream to be written
- Throws:
- IllegalArgumentException- if attachment is null
- IllegalArgumentException- if data is null
- AttachmentDataStreamSizeMismatchException- if bytes read from the data stream does not match- Attachment.getFileSize().
- Since:
- 5.5
 
- 
saveDataForAttachmentVersion@Deprecated void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream data) Deprecated.Saves data to the attachment data store, for an attachment that has been updated.This method assumes that the attachment has already been saved. - Parameters:
- attachment- the new version of the attachment
- previousVersion- the previous version of the attachment
- data- the InputStream representing the data
- Throws:
- AttachmentDataStreamSizeMismatchException- if bytes read from the data stream does not match- Attachment.getFileSize().
 
- 
saveDataForAttachmentVersionvoid saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, AttachmentDataStream dataStream) Saves data to the attachment data store, for an attachment that has been updated.This method assumes that the attachment has already been saved. - Parameters:
- attachment- the new version of the attachment
- previousVersion- the previous version of the attachment
- dataStream- the InputStream representing the data
- Throws:
- AttachmentDataStreamSizeMismatchException- if bytes read from the data stream does not match- Attachment.getFileSize().
- Since:
- 5.5
 
- 
replaceDataForAttachmentDeprecated.Sets the data for attachmentThis method will overwrite any existing data for the attachment. - Parameters:
- attachment- Attachment the data belongs to
- data- the data to be saved
- Throws:
- AttachmentDataStreamSizeMismatchException- if bytes read from the data stream does not match- Attachment.getFileSize().
 
- 
replaceDataForAttachmentSets the data for attachmentThis method will overwrite any existing data for the attachment. - Parameters:
- attachment- Attachment the data belongs to
- dataStream- the data to be saved
- Throws:
- AttachmentDataStreamSizeMismatchException- if bytes read from the data stream does not match- Attachment.getFileSize().
- Since:
- 5.5
 
- 
isAttachmentPresentCheck that an attachment exists- Parameters:
- attachment- the Attachment to be checked
 
- 
moveAttachmentvoid moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent) Moves an attachment to a new file name or content object- Parameters:
- attachment- the Attachment to be moved
- oldAttachment- the original version of the attachment
- newContent- the new content the Attachment belongs to
- Throws:
- IllegalArgumentException- if attachment is null
- IllegalArgumentException- if newFileName is null
- IllegalArgumentException- if newContent is null
 
- 
getStorageTypeAttachmentDataStorageType getStorageType()Returns the storage type.The client code should be storage agnostic in general. Thus this method should only be used in rare cases in order to hide operations which are known to be not implemented for the specific type. - Returns:
- the storage type
- Since:
- 4.3
 
 
- 
getDataForAttachment(com.atlassian.confluence.pages.Attachment, AttachmentDataStreamType)