public class FileSystemAttachmentDirectoryAccessor extends Object implements AttachmentDirectoryAccessor
Modifier and Type | Field and Description |
---|---|
protected ProjectManager |
projectManager |
Constructor and Description |
---|
FileSystemAttachmentDirectoryAccessor(ProjectManager projectManager,
AttachmentPathManager attachmentPathManager,
StreamAttachmentStore streamAttachmentStore,
AttachmentConfigManager attachmentConfigManager) |
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.
|
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)
Returns the attachment directory for the given issue.
|
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()
Returns the directory in which Jira stores temporary attachments.
|
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, StreamAttachmentStore streamAttachmentStore, AttachmentConfigManager attachmentConfigManager)
@Nonnull public File getThumbnailDirectory(@Nonnull Issue issue)
getThumbnailDirectory
in interface AttachmentDirectoryAccessor
issue
- the issue whose thumbnail directory you want@Nonnull public File getThumbnailDirectory(@Nonnull Issue issue, boolean createDirectory)
getThumbnailDirectory
in interface AttachmentDirectoryAccessor
issue
- 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 AttachmentDirectoryAccessor
issue
- the issue whose attachment directory you want (required)@Nullable public File getAttachmentDirectory(@Nonnull String issueKey)
AttachmentDirectoryAccessor
getAttachmentDirectory
in interface AttachmentDirectoryAccessor
issueKey
- the issue keynull
if the project key is invalidpublic File getAttachmentDirectory(@Nonnull Issue issue, boolean createDirectory)
getAttachmentDirectory
in interface AttachmentDirectoryAccessor
issue
- the issue whose attachment directory you wantcreateDirectory
- If true, and the directory does not currently exist, then the directory is created.@Nonnull public File getTemporaryAttachmentDirectory()
AttachmentDirectoryAccessor
getTemporaryAttachmentDirectory
in interface AttachmentDirectoryAccessor
public File getAttachmentDirectory(String attachmentDirectory, String projectKey, String issueKey)
AttachmentDirectoryAccessor
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 AttachmentDirectoryAccessor
attachmentDirectory
- 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 AttachmentDirectoryAccessor
issue
- 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
AttachmentDirectoryAccessor
checkValidTemporaryAttachmentDirectory
in interface AttachmentDirectoryAccessor
AttachmentException
- if the directory is not writable or missing and cannot be created.public File getAttachmentRootPath()
AttachmentDirectoryAccessor
getAttachmentRootPath
in interface AttachmentDirectoryAccessor
@Nonnull public ErrorCollection errors()
errors
in interface AttachmentHealth
Copyright © 2002-2023 Atlassian. All Rights Reserved.