public interface AttachmentDataDao
Modifier and Type | Method and Description |
---|---|
void |
afterMigrationFrom()
Perform any tasks necessary after Attachment data has been moved from
this data store to another.
|
InputStream |
getDataForAttachment(Attachment attachment)
Deprecated.
|
AttachmentDataStream |
getDataForAttachment(Attachment attachment,
AttachmentDataStreamType dataStreamType)
Grabs the AttachmentData object for an Attachment
|
AttachmentDataStream |
getDataForAttachment(Attachment attachment,
AttachmentDataStreamType dataStreamType,
Optional<RangeRequest> range)
Grabs the AttachmentData object for an Attachment
|
AttachmentDataStorageType |
getStorageType()
Returns the storage type.
|
boolean |
isAttachmentPresent(Attachment attachment)
Check that an attachment exists
|
void |
moveAttachment(Attachment attachment,
Attachment oldAttachment,
ContentEntityObject newContent)
Moves an attachment to a new file name or content object
|
void |
moveDataForAttachmentVersion(Attachment sourceAttachmentVersion,
Attachment targetAttachmentVersion)
Moves the attachment data from one
AbstractVersionedEntityObject.getVersion() to the other. |
void |
prepareForMigrationTo()
Prepare the data store for a migration from another type of data store.
|
void |
removeDataForAttachment(Attachment attachment,
ContentEntityObject originalContent)
Removes all attachment data for the given attachment.
|
void |
removeDataForAttachmentVersion(Attachment attachmentVersion,
ContentEntityObject originalContent)
Removes the attachment data for the given attachment version.
|
void |
removeDataForAttachmentVersion(Attachment attachmentVersion,
ContentEntityObject originalContent,
AttachmentDataStreamType dataStreamType)
Removes the attachment data of the specific stream type for the given attachment version.
|
void |
replaceDataForAttachment(Attachment attachment,
AttachmentDataStream dataStream)
Sets the data for attachment
|
void |
replaceDataForAttachment(Attachment attachment,
InputStream data)
Deprecated.
|
void |
saveDataForAttachment(Attachment attachment,
AttachmentDataStream dataStream)
Saves data to the attachment data store
|
void |
saveDataForAttachment(Attachment attachment,
InputStream data)
Deprecated.
|
void |
saveDataForAttachmentVersion(Attachment attachment,
Attachment previousVersion,
AttachmentDataStream dataStream)
Saves data to the attachment data store, for an attachment
that has been updated.
|
void |
saveDataForAttachmentVersion(Attachment attachment,
Attachment previousVersion,
InputStream data)
|
@Deprecated InputStream getDataForAttachment(Attachment attachment) throws AttachmentDataNotFoundException
getDataForAttachment(com.atlassian.confluence.pages.Attachment, AttachmentDataStreamType)
attachment
- the Attachment representing the dataIllegalArgumentException
- if attachment is nullAttachmentDataNotFoundException
- if no data was foundAttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType) throws AttachmentDataNotFoundException
attachment
- the Attachment representing the dataIllegalArgumentException
- if attachment is nullAttachmentDataNotFoundException
- if no data was foundAttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range) throws AttachmentDataNotFoundException
attachment
- the Attachment representing the datadataStreamType
- the stream type of attachmentrange
- the range of attachment dataIllegalArgumentException
- if attachment is nullAttachmentDataNotFoundException
- if no data was foundvoid removeDataForAttachment(Attachment attachment, ContentEntityObject originalContent)
attachment
- the latest version of the attachment for which the data should be removedoriginalContent
- the content the attachment belongs toIllegalArgumentException
- if attachment is nullvoid removeDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent)
attachmentVersion
- the version of the attachment for which the data should be removedoriginalContent
- the content the attachment belongs toIllegalArgumentException
- if attachment is nullvoid removeDataForAttachmentVersion(Attachment attachmentVersion, ContentEntityObject originalContent, AttachmentDataStreamType dataStreamType)
attachmentVersion
- the version of the attachment for which the data should be removedoriginalContent
- the content the attachment belongs todataStreamType
- the data stream typeIllegalArgumentException
- if attachment is nullvoid moveDataForAttachmentVersion(Attachment sourceAttachmentVersion, Attachment targetAttachmentVersion)
AbstractVersionedEntityObject.getVersion()
to the other.
This method will overwrite any existing data for the target attachment version.
sourceAttachmentVersion
- the attachmenttargetAttachmentVersion
- IllegalArgumentException
- if the Attachment.getContainer()
differsmoveAttachment(Attachment, Attachment, ContentEntityObject)
@Deprecated void saveDataForAttachment(Attachment attachment, InputStream data)
saveDataForAttachment(com.atlassian.confluence.pages.Attachment, AttachmentDataStream)
attachment
- the Attachment the data belongs todata
- the InputStream to be writtenIllegalArgumentException
- if attachment is nullIllegalArgumentException
- if data is nullAttachmentDataStreamSizeMismatchException
- if bytes read from the data stream does not match Attachment.getFileSize()
.void saveDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
attachment
- the Attachment the data belongs todataStream
- the data stream to be writtenIllegalArgumentException
- if attachment is nullIllegalArgumentException
- if data is nullAttachmentDataStreamSizeMismatchException
- if bytes read from the data stream does not match Attachment.getFileSize()
.@Deprecated void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream data)
saveDataForAttachmentVersion(com.atlassian.confluence.pages.Attachment, com.atlassian.confluence.pages.Attachment, AttachmentDataStream)
This method assumes that the attachment has already been saved.
attachment
- the new version of the attachmentpreviousVersion
- the previous version of the attachmentdata
- the InputStream representing the dataAttachmentDataStreamSizeMismatchException
- if bytes read from the data stream does not match Attachment.getFileSize()
.void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, AttachmentDataStream dataStream)
This method assumes that the attachment has already been saved.
attachment
- the new version of the attachmentpreviousVersion
- the previous version of the attachmentdataStream
- the InputStream representing the dataAttachmentDataStreamSizeMismatchException
- if bytes read from the data stream does not match Attachment.getFileSize()
.@Deprecated void replaceDataForAttachment(Attachment attachment, InputStream data)
replaceDataForAttachment(com.atlassian.confluence.pages.Attachment, AttachmentDataStream)
This method will overwrite any existing data for the attachment.
attachment
- Attachment the data belongs todata
- the data to be savedAttachmentDataStreamSizeMismatchException
- if bytes read from the data stream does not match Attachment.getFileSize()
.void replaceDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
This method will overwrite any existing data for the attachment.
attachment
- Attachment the data belongs todataStream
- the data to be savedAttachmentDataStreamSizeMismatchException
- if bytes read from the data stream does not match Attachment.getFileSize()
.boolean isAttachmentPresent(Attachment attachment)
attachment
- the Attachment to be checkedvoid moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)
attachment
- the Attachment to be movedoldAttachment
- the original version of the attachmentnewContent
- the new content the Attachment belongs toIllegalArgumentException
- if attachment is nullIllegalArgumentException
- if newFileName is nullIllegalArgumentException
- if newContent is nullvoid prepareForMigrationTo()
Classes implementing this method will perform any tasks necessary to allow the data store to be used.
Implementations may circumvent hibernate, so should only be called when nobody else can see the attachment data.
RuntimeException
- if there was a problemvoid afterMigrationFrom()
Implementations may circumvent hibernate, so should only be called when nobody else can see the attachment data.
RuntimeException
- if there was a problemAttachmentDataStorageType getStorageType()
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.
Copyright © 2003–2018 Atlassian. All rights reserved.