FileSystemAttachmentDataDao
@Deprecated public class FileSystemAttachmentDataDao extends Object implements NonTransactionalAttachmentDataDao
Modifier and Type | Class and Description |
---|---|
static interface |
FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy
Deprecated.
|
Modifier and Type | Field and Description |
---|---|
protected FileLocationResolver |
attachmentsDirResolver
Deprecated.
|
static FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy |
NAMING_STRATEGY_FILE_NAME
Deprecated.
|
static FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy |
NAMING_STRATEGY_ID
Deprecated.
|
Constructor and Description |
---|
FileSystemAttachmentDataDao()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
afterMigrationFrom()
Deprecated.
In this implementation, we leave the filesystem as is, and don't
remove the attachments that have just been moved to another data store.
|
FileLocationResolver |
getAttachmentsDirResolver()
Deprecated.
|
protected File |
getConfluenceAttachmentDirectory()
Deprecated.
|
InputStream |
getDataForAttachment(Attachment attachment)
Deprecated.
Grabs the AttachmentData object for an Attachment
|
AttachmentDataStream |
getDataForAttachment(Attachment attachment,
AttachmentDataStreamType dataStreamType)
Deprecated.
Grabs the AttachmentData object for an Attachment
|
AttachmentDataStream |
getDataForAttachment(Attachment attachment,
AttachmentDataStreamType dataStreamType,
Optional<RangeRequest> range)
Deprecated.
Grabs the AttachmentData object for an Attachment
|
protected File |
getDirectoryForAttachment(ContentEntityObject content,
Attachment attachment)
Deprecated.
Retrieves the location of the containing folder for an Attachment
|
protected File |
getDirectoryForContent(ContentEntityObject content)
Deprecated.
|
protected File |
getLatestAttachmentFile(Attachment attachment)
Deprecated.
|
FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy |
getNamingStrategy()
Deprecated.
|
AttachmentDataStorageType |
getStorageType()
Deprecated.
Returns the storage type.
|
boolean |
isAttachmentPresent(Attachment attachment)
Deprecated.
Check that an attachment exists
|
void |
moveAttachment(Attachment attachment,
Attachment oldAttachment,
ContentEntityObject newContent)
Deprecated.
Moves an attachment to a new file name or content object
|
void |
moveDataForAttachmentVersion(Attachment sourceAttachmentVersion,
Attachment targetAttachmentVersion)
Deprecated.
Moves the attachment data from one
AbstractVersionedEntityObject.getVersion() to the other. |
void |
prepareForMigrationTo()
Deprecated.
In this implementation, we want to make sure the attachments directory is empty,
otherwise we will have attachments or files that don't belong.
|
void |
removeDataForAttachment(Attachment attachment,
ContentEntityObject originalContent)
Deprecated.
Removes all attachment data for the given attachment.
|
void |
removeDataForAttachmentVersion(Attachment attachment,
ContentEntityObject originalContent)
Deprecated.
Removes the attachment data for the given attachment version.
|
void |
removeDataForAttachmentVersion(Attachment attachment,
ContentEntityObject originalContent,
AttachmentDataStreamType dataStreamType)
Deprecated.
Removes the attachment data of the specific stream type for the given attachment version.
|
void |
replaceDataForAttachment(Attachment attachment,
AttachmentDataStream dataStream)
Deprecated.
Sets the data for attachment
|
void |
replaceDataForAttachment(Attachment attachment,
InputStream data)
Deprecated.
Sets the data for attachment
|
void |
saveDataForAttachment(Attachment attachment,
AttachmentDataStream dataStream)
Deprecated.
Saves data to the attachment data store
|
void |
saveDataForAttachment(Attachment attachment,
InputStream data)
Deprecated.
Saves data to the attachment data store
|
protected void |
saveDataForAttachment(Attachment attachment,
InputStream data,
boolean overwrite)
Deprecated.
Saves data to the file system
|
void |
saveDataForAttachmentVersion(Attachment attachment,
Attachment previousVersion,
AttachmentDataStream dataStream)
Deprecated.
Saves data to the attachment data store, for an attachment
that has been updated.
|
void |
saveDataForAttachmentVersion(Attachment attachment,
Attachment previousVersion,
InputStream data)
Deprecated.
Saves data to the attachment data store, for an attachment
that has been updated.
|
void |
setAttachmentsDirResolver(FileLocationResolver attachmentsDirResolver)
Deprecated.
|
void |
setNamingStrategy(FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy namingStrategy)
Deprecated.
|
protected FileLocationResolver attachmentsDirResolver
public static final FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy NAMING_STRATEGY_ID
public static final FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy NAMING_STRATEGY_FILE_NAME
public FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy getNamingStrategy()
public void setNamingStrategy(FileSystemAttachmentDataDao.FileSystemAttachmentNamingStrategy namingStrategy)
protected File getConfluenceAttachmentDirectory()
protected File getLatestAttachmentFile(Attachment attachment)
public InputStream getDataForAttachment(Attachment attachment) throws AttachmentDataNotFoundException
AttachmentDataDao
getDataForAttachment
in interface AttachmentDataDao
attachment
- the Attachment representing the dataAttachmentDataNotFoundException
- if no data was foundpublic void removeDataForAttachment(Attachment attachment, ContentEntityObject originalContent)
This method will remove any empty folders left after removing the attachment data.
removeDataForAttachment
in interface AttachmentDataDao
attachment
- the attachment for which data should be removedoriginalContent
- the content the attachment belongs topublic void removeDataForAttachmentVersion(Attachment attachment, ContentEntityObject originalContent)
This method will remove any empty folders left after removing the attachment data.
removeDataForAttachmentVersion
in interface AttachmentDataDao
attachment
- the attachment for which data should be removedoriginalContent
- the content the attachment belongs topublic void removeDataForAttachmentVersion(Attachment attachment, ContentEntityObject originalContent, AttachmentDataStreamType dataStreamType)
AttachmentDataDao
removeDataForAttachmentVersion
in interface AttachmentDataDao
attachment
- the version of the attachment for which the data should be removedoriginalContent
- the content the attachment belongs todataStreamType
- the data stream typepublic void moveDataForAttachmentVersion(Attachment sourceAttachmentVersion, Attachment targetAttachmentVersion)
AttachmentDataDao
AbstractVersionedEntityObject.getVersion()
to the other.
This method will overwrite any existing data for the target attachment version.
moveDataForAttachmentVersion
in interface AttachmentDataDao
sourceAttachmentVersion
- the attachmentAttachmentDataDao.moveAttachment(Attachment, Attachment, ContentEntityObject)
public void saveDataForAttachment(Attachment attachment, InputStream data)
AttachmentDataDao
saveDataForAttachment
in interface AttachmentDataDao
attachment
- the Attachment the data belongs todata
- the InputStream to be writtenpublic FileLocationResolver getAttachmentsDirResolver()
protected void saveDataForAttachment(Attachment attachment, InputStream data, boolean overwrite)
attachment
- the Attachment the data belongs todata
- the InputStream to be writtenoverwrite
- IllegalArgumentException
- if attachment is nullIllegalArgumentException
- if data is nullpublic void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, InputStream data)
AttachmentDataDao
This method assumes that the attachment has already been saved.
saveDataForAttachmentVersion
in interface AttachmentDataDao
attachment
- the new version of the attachmentpreviousVersion
- the previous version of the attachmentdata
- the InputStream representing the datapublic void replaceDataForAttachment(Attachment attachment, InputStream data)
AttachmentDataDao
This method will overwrite any existing data for the attachment.
replaceDataForAttachment
in interface AttachmentDataDao
attachment
- Attachment the data belongs todata
- the data to be savedpublic boolean isAttachmentPresent(Attachment attachment)
AttachmentDataDao
isAttachmentPresent
in interface AttachmentDataDao
attachment
- the Attachment to be checkedpublic void moveAttachment(Attachment attachment, Attachment oldAttachment, ContentEntityObject newContent)
AttachmentDataDao
moveAttachment
in interface AttachmentDataDao
attachment
- the Attachment to be movedoldAttachment
- the original version of the attachmentnewContent
- the new content the Attachment belongs toprotected File getDirectoryForAttachment(ContentEntityObject content, Attachment attachment)
content
- the ContentEntityObject the Attachment belongs toattachment
- protected File getDirectoryForContent(ContentEntityObject content)
public void prepareForMigrationTo()
We also want to make sure the attachments directory actually exists, prior to moving data across.
It is the responsibility of the action performing the migration to warn the user about this.
prepareForMigrationTo
in interface AttachmentDataDao
public void afterMigrationFrom()
afterMigrationFrom
in interface AttachmentDataDao
public void setAttachmentsDirResolver(FileLocationResolver attachmentsDirResolver)
public AttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType) throws AttachmentDataNotFoundException
AttachmentDataDao
getDataForAttachment
in interface AttachmentDataDao
attachment
- the Attachment representing the dataAttachmentDataNotFoundException
- if no data was foundpublic AttachmentDataStream getDataForAttachment(Attachment attachment, AttachmentDataStreamType dataStreamType, Optional<RangeRequest> range) throws AttachmentDataNotFoundException
AttachmentDataDao
getDataForAttachment
in interface AttachmentDataDao
attachment
- the Attachment representing the datadataStreamType
- the stream type of attachmentrange
- the range of attachment dataAttachmentDataNotFoundException
- if no data was foundpublic void saveDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
AttachmentDataDao
saveDataForAttachment
in interface AttachmentDataDao
attachment
- the Attachment the data belongs todataStream
- the data stream to be writtenpublic void saveDataForAttachmentVersion(Attachment attachment, Attachment previousVersion, AttachmentDataStream dataStream)
AttachmentDataDao
This method assumes that the attachment has already been saved.
saveDataForAttachmentVersion
in interface AttachmentDataDao
attachment
- the new version of the attachmentpreviousVersion
- the previous version of the attachmentdataStream
- the InputStream representing the datapublic void replaceDataForAttachment(Attachment attachment, AttachmentDataStream dataStream)
AttachmentDataDao
This method will overwrite any existing data for the attachment.
replaceDataForAttachment
in interface AttachmentDataDao
attachment
- Attachment the data belongs todataStream
- the data to be savedpublic AttachmentDataStorageType getStorageType()
AttachmentDataDao
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.
getStorageType
in interface AttachmentDataDao
Copyright © 2003–2017 Atlassian. All rights reserved.