com.atlassian.jira.issue.attachment
Interface FileBasedAttachmentStore

All Superinterfaces:
AttachmentHealth, SimpleAttachmentStore
All Known Subinterfaces:
FileSystemAttachmentStore
All Known Implementing Classes:
DefaultAttachmentStore

public interface FileBasedAttachmentStore
extends SimpleAttachmentStore

Interface for an attachment store that presents a File-based interface for accessing attachments. TODO - We should be able to remove this once we provide sufficient methods in SimpleAttachmentStore to eliminate access to attachments via files.

Since:
v6.3

Method Summary
 com.atlassian.util.concurrent.Promise<io.atlassian.blobstore.client.api.Unit> deleteAttachmentContainerForIssue(Issue issue)
          Delete the container for attachments for a given issue.
 File getAttachmentFile(Attachment attachment)
          Returns the physical File for the given Attachment.
 File getAttachmentFile(AttachmentStore.AttachmentAdapter attachment, File attachmentDir)
          This is intended for cases where you want more control over where the attachment actually lives and you just want something to handle the look up logic for the various possible filenames an attachment can have.
 File getAttachmentFile(Issue issue, Attachment attachment)
          Returns the physical File for the given Attachment.
 
Methods inherited from interface com.atlassian.jira.issue.attachment.SimpleAttachmentStore
delete, exists, get, move, put, put
 
Methods inherited from interface com.atlassian.jira.issue.attachment.AttachmentHealth
errors
 

Method Detail

getAttachmentFile

File getAttachmentFile(Issue issue,
                       Attachment attachment)
                       throws DataAccessException
Returns the physical File for the given Attachment. This method performs better as it does not need to look up the issue object.

Parameters:
issue - the issue the attachment belongs to.
attachment - the attachment.
Returns:
the file.
Throws:
DataAccessException - on failure getting required attachment info.

getAttachmentFile

File getAttachmentFile(Attachment attachment)
                       throws DataAccessException
Returns the physical File for the given Attachment. If you are calling this on multiple attachments for the same issue, consider using the overriden method that passes in the issue. Else, this goes to the database for each call.

Parameters:
attachment - the attachment.
Returns:
the file.
Throws:
DataAccessException - on failure getting required attachment info.

getAttachmentFile

File getAttachmentFile(AttachmentStore.AttachmentAdapter attachment,
                       File attachmentDir)
This is intended for cases where you want more control over where the attachment actually lives and you just want something to handle the look up logic for the various possible filenames an attachment can have.

In practice, this is just used during Project Import

Parameters:
attachment - it's not an attachment but it acts like one for our purposes.
attachmentDir - the directory the attachments live in. This is different that the system-wide attachment directory. i.e. this would "attachments/MKY/MKY-1" and not just "attachments"
Returns:
the actual attachment

deleteAttachmentContainerForIssue

com.atlassian.util.concurrent.Promise<io.atlassian.blobstore.client.api.Unit> deleteAttachmentContainerForIssue(@Nonnull
                                                                                                                Issue issue)
Delete the container for attachments for a given issue. For file systems, this means the attachment directory for that issue.

Parameters:
issue - The issue to delete attachments for.
Returns:
A promise that will contain a AttachmentCleanupException if there is a problem deleting the attachment directory.


Copyright © 2002-2014 Atlassian. All Rights Reserved.