public class FileSystemAttachmentDirectoryAccessor extends Object implements AttachmentDirectoryAccessor
| Modifier and Type | Field and Description |
|---|---|
protected ProjectManager |
projectManager |
| Constructor and Description |
|---|
FileSystemAttachmentDirectoryAccessor(ProjectManager projectManager,
AttachmentPathManager attachmentPathManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkValidAttachmentDirectory(Issue issue)
Checks that the Attachment directory of the given issue is right to go - writable, accessible etc.
|
void |
checkValidTemporaryAttachmentDirectory()
Checks that the temporary directory where attachments can be uploaded is writeable.
|
io.atlassian.fugue.Option<ErrorCollection> |
errors()
Checks that the attachment root directory and the temporary attachment directories exist and are writeable.
|
File |
getAttachmentDirectory(Issue issue)
Returns the physical directory of the attachments for the given issue.
|
File |
getAttachmentDirectory(Issue issue,
boolean createDirectory)
Returns the physical directory of the attachments for the given issue.
|
File |
getAttachmentDirectory(String issueKey) |
File |
getAttachmentDirectory(String attachmentDirectory,
String projectKey,
String issueKey)
Get the attachment directory for the given attachment base directory, project key, and issue key.
|
File |
getAttachmentRootPath()
Returns the path used to store all attachments across the system.
|
File |
getTemporaryAttachmentDirectory() |
File |
getThumbnailDirectory(Issue issue)
Returns the physical directory of the thumbnails for the given issue, creating if necessary.
|
File |
getThumbnailDirectory(Issue issue,
boolean createDirectory)
Returns the physical directory of the thumbnails for the given issue, creating if desired.
|
protected final ProjectManager projectManager
public FileSystemAttachmentDirectoryAccessor(ProjectManager projectManager, AttachmentPathManager attachmentPathManager)
@Nonnull public File getThumbnailDirectory(@Nonnull Issue issue)
getThumbnailDirectory in interface AttachmentDirectoryAccessorissue - the issue whose thumbnail directory you want@Nonnull public File getThumbnailDirectory(@Nonnull Issue issue, boolean createDirectory)
getThumbnailDirectory in interface AttachmentDirectoryAccessorissue - the issue whose thumbnail directory you wantcreateDirectory - If true, and the directory does not currently exist, then the directory is created.public File getAttachmentDirectory(@Nonnull Issue issue)
getAttachmentDirectory in interface AttachmentDirectoryAccessorissue - the issue whose attachment directory you want (required)@Nullable public File getAttachmentDirectory(@Nonnull String issueKey)
getAttachmentDirectory in interface AttachmentDirectoryAccessorpublic File getAttachmentDirectory(@Nonnull Issue issue, boolean createDirectory)
getAttachmentDirectory in interface AttachmentDirectoryAccessorissue - the issue whose attachment directory you wantcreateDirectory - If true, and the directory does not currently exist, then the directory is created.public File getTemporaryAttachmentDirectory()
getTemporaryAttachmentDirectory in interface AttachmentDirectoryAccessorpublic File getAttachmentDirectory(String attachmentDirectory, String projectKey, String issueKey)
The idea is to encapsulate all of the path-joinery magic to make future refactoring easier if we ever decide to move away from attachment-base/project-key/issue-ket
getAttachmentDirectory in interface AttachmentDirectoryAccessorattachmentDirectory - base of attachmentsprojectKey - the project key the issue belongs toissueKey - the issue key for the issuepublic void checkValidAttachmentDirectory(Issue issue) throws AttachmentException
checkValidAttachmentDirectory in interface AttachmentDirectoryAccessorissue - the issue whose attachment directory to check.AttachmentException - if the directory is not writable or missing and cannot be created.public void checkValidTemporaryAttachmentDirectory()
throws AttachmentException
AttachmentDirectoryAccessorcheckValidTemporaryAttachmentDirectory in interface AttachmentDirectoryAccessorAttachmentException - if the directory is not writable or missing and cannot be created.public File getAttachmentRootPath()
AttachmentDirectoryAccessorgetAttachmentRootPath in interface AttachmentDirectoryAccessorpublic io.atlassian.fugue.Option<ErrorCollection> errors()
errors in interface AttachmentHealthCopyright © 2002-2021 Atlassian. All Rights Reserved.