public class DefaultAttachmentService extends Object implements AttachmentService
Constructor and Description |
---|
DefaultAttachmentService(AttachmentManager attachmentManager,
AttachmentValidator attachmentValidator,
PermissionManager permissionManager,
JiraAuthenticationContext jiraAuthenticationContext,
IssueUpdater issueUpdater,
IssueManager issueManager,
AttachmentHandler attachmentHandler) |
Modifier and Type | Method and Description |
---|---|
boolean |
canAttachScreenshots(JiraServiceContext jiraServiceContext,
Issue issue)
Determines whether the user:
has the required permission (
Permissions.CREATE_ATTACHMENT )
to create an attachment
has the screenshot enabled
is using a screenshot applet compatible OS (Windows or OSX)
the issue is in an editable workflow state
|
boolean |
canCreateAttachments(JiraServiceContext jiraServiceContext,
Issue issue)
Determines whether attachments are enabled in JIRA and that the user has the required permission
(
Permissions.CREATE_ATTACHMENT ) to create an attachment for this issue. |
boolean |
canCreateAttachments(JiraServiceContext jiraServiceContext,
Project project)
Determines whether attachments are enabled in JIRA and that the user has the required permission
(
Permissions.CREATE_ATTACHMENT ) to create an attachment for this project. |
boolean |
canCreateTemporaryAttachments(JiraServiceContext jiraServiceContext,
Issue issue)
Determines whether:
the user has the required permission (
Permissions.CREATE_ATTACHMENT )
to create an attachment
attachments are enabled
This method does *not* check if the issue is in an editable workflow step, since temporary
attachments may be created when reopening an issue *before* the issue is actually reopened! |
boolean |
canDeleteAttachment(JiraServiceContext jiraServiceContext,
Long attachmentId)
Retrieves the attachment specified by the attachment id and determines if the user can delete it.
|
boolean |
canManageAttachments(JiraServiceContext jiraServiceContext,
Issue issue)
Checks whether the user has permission to manage the attachments of the specified issue.
|
void |
delete(JiraServiceContext jiraServiceContext,
Long attachmentId)
Deletes the specified attachment and updates the issue change history and 'updated' date.
|
Attachment |
getAttachment(JiraServiceContext jiraServiceContext,
Long attachmentId)
Retrieves the specified issue.
|
public DefaultAttachmentService(AttachmentManager attachmentManager, AttachmentValidator attachmentValidator, PermissionManager permissionManager, JiraAuthenticationContext jiraAuthenticationContext, IssueUpdater issueUpdater, IssueManager issueManager, AttachmentHandler attachmentHandler)
public boolean canDeleteAttachment(JiraServiceContext jiraServiceContext, Long attachmentId)
AttachmentService
canDeleteAttachment
in interface AttachmentService
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodattachmentId
- specifies the attachment to be deletedpublic boolean canManageAttachments(JiraServiceContext jiraServiceContext, Issue issue)
AttachmentService
canManageAttachments
in interface AttachmentService
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodissue
- who's attachments will be checked against the specified user's delete permissions (if the issue
is null an error will be placed into the supplied ErrorCollection and false will be returned)public void delete(JiraServiceContext jiraServiceContext, Long attachmentId)
AttachmentService
This method expects that AttachmentService.canDeleteAttachment(com.atlassian.jira.bc.JiraServiceContext, Long)
has been successfully called.
delete
in interface AttachmentService
jiraServiceContext
- containing the user who is attempting to delete the attachment and the errorCollection
that will contain any errors in calling the methodattachmentId
- of the target attachment, must not be null and must identify a valid attachmentpublic Attachment getAttachment(JiraServiceContext jiraServiceContext, Long attachmentId) throws AttachmentNotFoundException
AttachmentService
getAttachment
in interface AttachmentService
jiraServiceContext
- containing the user who is attempting to retrieve the attachment and the errorCollection
that will contain any errors in calling the methodattachmentId
- of the target attachment, must not be null and must identify a valid attachmentAttachmentNotFoundException
- if the attachment does not existpublic boolean canCreateAttachments(JiraServiceContext jiraServiceContext, @Nullable Project project)
AttachmentService
Permissions.CREATE_ATTACHMENT
) to create an attachment for this project.canCreateAttachments
in interface AttachmentService
jiraServiceContext
- containing the user who wishes to create an attachment and the errorCollection
that will contain any errors in calling the methodproject
- where the attachment will be created inpublic boolean canCreateTemporaryAttachments(JiraServiceContext jiraServiceContext, @Nullable Issue issue)
AttachmentService
Permissions.CREATE_ATTACHMENT
)
to create an attachmentcanCreateTemporaryAttachments
in interface AttachmentService
jiraServiceContext
- containing the user who wishes to attach a file and the errorCollection
that will contain any errors in calling the methodissue
- that will have the file attached to itpublic boolean canCreateAttachments(JiraServiceContext jiraServiceContext, Issue issue)
AttachmentService
Permissions.CREATE_ATTACHMENT
) to create an attachment for this issue.
This method also checks that the provided issue is in an editable workflow state.canCreateAttachments
in interface AttachmentService
jiraServiceContext
- containing the user who wishes to create an attachment and the errorCollection
that will contain any errors in calling the methodissue
- that will have an attachment attached to itpublic boolean canAttachScreenshots(JiraServiceContext jiraServiceContext, Issue issue)
AttachmentService
Permissions.CREATE_ATTACHMENT
)
to create an attachmentcanAttachScreenshots
in interface AttachmentService
jiraServiceContext
- containing the user who wishes to attach a screenshot and the errorCollection
that will contain any errors in calling the methodissue
- that will have the screenshot attached to itCopyright © 2002-2022 Atlassian. All Rights Reserved.