public interface

FileBasedAttachmentStore

implements SimpleAttachmentStore
com.atlassian.jira.issue.attachment.FileBasedAttachmentStore
Known Indirect Subclasses

Class Overview

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.

Summary

Public Methods
Promise<Unit> deleteAttachmentContainerForIssue(Issue issue)
Delete the container for attachments for a given issue.
File getAttachmentFile(Issue issue, Attachment attachment)
Returns the physical File for the given Attachment.
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.
[Expand]
Inherited Methods
From interface com.atlassian.jira.issue.attachment.AttachmentHealth
From interface com.atlassian.jira.issue.attachment.SimpleAttachmentStore

Public Methods

public Promise<Unit> deleteAttachmentContainerForIssue (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.

public File getAttachmentFile (Issue issue, Attachment attachment)

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.

public File getAttachmentFile (Attachment attachment)

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.

public 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