|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.pages.persistence.dao.filesystem.HierarchicalMultiStreamAttachmentDataFileSystem
public class HierarchicalMultiStreamAttachmentDataFileSystem
An implementation of AttachmentDataFileSystem which stores the
attachment data as files on a filesystem, using the standard File API.
The files are stored within a hierarchical directory structure that incorporates the IDs of the space, content entity
and attachment IDs to which the attachment data belongs to. Data corresponding to each version of the attachment are
stored, as are different "streams" of data for each version (see AttachmentDataStreamType.
For attachments belonging to "spaced" content entities (e.g. pages, blogs), the directory structure is described by
the following pattern: "h1/h2/spaceId/h3/h4/contentId/attachmentId/attachmentFile"
where h1 and h2 are hashcodes generated from the spaceId, h3 and h4 are hashcodes generated from the contentId,
and attachmentFile represents a combination of the attachment version and the data stream type. For
backwards compatibility with HierarchicalFileSystemAttachmentDataDao,
attachment files of type AttachmentDataStreamType.RAW_BINARY have a filename of just the numeric
attachment version. For other stream types, the filename is "version.streamType" (e.g. "1.extracted_text").
For "non-spaced" entity attachments (e.g. user profile pictures), a simpler but similar structure is used:
"nonspaced/h3/h4/contentId/attachmentId/attachmentFile"
| Field Summary | |
|---|---|
static String |
NON_SPACED_DIRECTORY_NAME
|
| Constructor Summary | |
|---|---|
HierarchicalMultiStreamAttachmentDataFileSystem(FileLocationResolver rootDir)
Deprecated. Since 5.7.1. Inject the hierarchicalMultiStreamAttachmentDataFileSystem bean instead. |
|
HierarchicalMultiStreamAttachmentDataFileSystem(FileLocationResolver rootDir,
DeferredFileDeletionQueue deferredFileDeletionQueue)
|
|
| Method Summary | |
|---|---|
boolean |
dataExistsForAttachment(Attachment attachment)
Indicates whether the filesystem contains data for the given attachment |
void |
deleteAllAttachmentVersions(Attachment attachment,
ContentEntityObject originalContent)
Delete all data corresponding to all versions of the given attachment |
void |
deleteSingleAttachmentVersion(Attachment attachment,
ContentEntityObject originalContent)
Delete the data corresponding to a single attachment version |
AttachmentDataStream |
getAttachmentData(Attachment attachment,
AttachmentDataStreamType dataStreamType)
Fetches the data for a given attachment version and data stream type |
File |
getContainerDirectoryForAttachmentVersions(long latestVersionAttachmentId,
long contentId,
com.atlassian.fugue.Maybe<Long> spaceId)
Get the File representing the directory that contains all the versions of an attachment |
void |
moveAttachment(Attachment oldAttachment,
Attachment newAttachment,
ContentEntityObject newContent)
Move all data relating to one attachment to a new directory corresponding to the given new attachment and content entity. |
void |
moveAttachments(ContentEntityObject contentEntity,
Space oldSpace,
Space newSpace)
Move all data for all versions of all attachments corresponding to the given content entity in the given space, to the same entity in a different space. |
void |
moveDataForAttachmentVersion(Attachment sourceAttachmentVersion,
Attachment targetAttachmentVersion)
Move the data associated with one attachment version, to being associated with a different attachment version |
boolean |
saveAttachmentData(Attachment attachmentVersion,
AttachmentDataStream attachmentDataStream,
boolean overwrite)
Save new data corresponding to the given attachment. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NON_SPACED_DIRECTORY_NAME
| Constructor Detail |
|---|
@Deprecated public HierarchicalMultiStreamAttachmentDataFileSystem(FileLocationResolver rootDir)
public HierarchicalMultiStreamAttachmentDataFileSystem(FileLocationResolver rootDir,
DeferredFileDeletionQueue deferredFileDeletionQueue)
| Method Detail |
|---|
public boolean dataExistsForAttachment(Attachment attachment)
public void moveAttachment(Attachment oldAttachment,
Attachment newAttachment,
ContentEntityObject newContent)
oldAttachment - The attachment whose data is to be movednewAttachment - The attachment to which the data should be moved tonewContent - The content entity corresponding to the new attachment
public boolean saveAttachmentData(Attachment attachmentVersion,
AttachmentDataStream attachmentDataStream,
boolean overwrite)
attachmentVersion - The attachment to which the data should be associatedattachmentDataStream - The new dataoverwrite - If true, any existing data will be overwritten. If false, does nothing if data already exists.
public File getContainerDirectoryForAttachmentVersions(long latestVersionAttachmentId,
long contentId,
com.atlassian.fugue.Maybe<Long> spaceId)
File representing the directory that contains all the versions of an attachment
latestVersionAttachmentId - this should be the ID of the latest version or the directory will not existcontentId - the ID of the content containing the attachmentspaceId - the ID of the space the content belongs to
File representing the directory that contains all the versions of an attachment
public void deleteAllAttachmentVersions(Attachment attachment,
ContentEntityObject originalContent)
attachment - the attachment whose data is to be deletedoriginalContent - The content entity associated with the attachment
public void moveDataForAttachmentVersion(Attachment sourceAttachmentVersion,
Attachment targetAttachmentVersion)
sourceAttachmentVersion - The attachment version containing the datatargetAttachmentVersion - The attachment version to which the data should be moved
public void deleteSingleAttachmentVersion(Attachment attachment,
ContentEntityObject originalContent)
attachment - The attachment whose data should be deletedoriginalContent - The content entity associated with the attachment
public AttachmentDataStream getAttachmentData(Attachment attachment,
AttachmentDataStreamType dataStreamType)
attachment - The attachment version for which the data is to be fetcheddataStreamType - The type of the data stream to be fetched
AttachmentDataStream containing the result
public void moveAttachments(ContentEntityObject contentEntity,
Space oldSpace,
Space newSpace)
contentEntity - The content entity whose attachment data is to be movedoldSpace - The original space of the content entitynewSpace - The new space of the content entity
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||