@ParametersAreNonnullByDefault public class

DefaultTemporaryWebAttachmentManager

extends Object
implements TemporaryWebAttachmentManager
java.lang.Object
   ↳ com.atlassian.jira.issue.attachment.DefaultTemporaryWebAttachmentManager

Class Overview

Default implementation of TemporaryWebAttachmentManager.

Summary

Public Constructors
DefaultTemporaryWebAttachmentManager(AttachmentManager attachmentManager, AttachmentValidator attachmentValidator, I18nHelper.BeanFactory beanFactory, TemporaryWebAttachmentsMonitorLocator temporaryWebAttachmentsMonitorLocator, ApplicationProperties applicationProperties, TemporaryWebAttachmentFactory temporaryWebAttachmentsFactory)
Public Methods
void clearTemporaryAttachmentsByFormToken(String formToken)
Removes all remaining temporary attachments which were created with given form token.
AttachmentsBulkOperationResult<ChangeItemBean> convertTemporaryAttachments(ApplicationUser user, Issue issue, List<String> temporaryAttachmentsIds)
Converts temporary attachments created by createTemporaryWebAttachment(InputStream, String, String, long, Either, String, ApplicationUser) into real attachments.
@ParametersAreNonnullByDefault Either<AttachmentErrorTemporaryWebAttachment> createTemporaryWebAttachment(InputStream stream, String fileName, String contentType, long size, Either<IssueProject> target, String formToken, ApplicationUser user)
Creates new temporary attachment that may be later converted into real attachment.
Option<TemporaryWebAttachment> getTemporaryWebAttachment(String temporaryAttachmentId)
Gets temporary web attachment by string ID, which was produced by getStringId().
Collection<TemporaryWebAttachment> getTemporaryWebAttachmentsByFormToken(String formToken)
Gets all temporary attachments associated with given form token.
void updateTemporaryWebAttachment(String temporaryAttachmentId, TemporaryWebAttachment updated)
Updates existing temporary attachment object to new state.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.issue.attachment.TemporaryWebAttachmentManager

Public Constructors

public DefaultTemporaryWebAttachmentManager (AttachmentManager attachmentManager, AttachmentValidator attachmentValidator, I18nHelper.BeanFactory beanFactory, TemporaryWebAttachmentsMonitorLocator temporaryWebAttachmentsMonitorLocator, ApplicationProperties applicationProperties, TemporaryWebAttachmentFactory temporaryWebAttachmentsFactory)

Public Methods

public void clearTemporaryAttachmentsByFormToken (String formToken)

Removes all remaining temporary attachments which were created with given form token.

Parameters
formToken form toke used to identify temporary attachments to remove

public AttachmentsBulkOperationResult<ChangeItemBean> convertTemporaryAttachments (ApplicationUser user, Issue issue, List<String> temporaryAttachmentsIds)

Converts temporary attachments created by createTemporaryWebAttachment(InputStream, String, String, long, Either, String, ApplicationUser) into real attachments.

Parameters
user user which is performing conversion
issue target issue for new attachments
temporaryAttachmentsIds temporary attachments string IDs.
Returns
  • bulk operation result

@ParametersAreNonnullByDefault public Either<AttachmentErrorTemporaryWebAttachment> createTemporaryWebAttachment (InputStream stream, String fileName, String contentType, long size, Either<IssueProject> target, String formToken, ApplicationUser user)

Creates new temporary attachment that may be later converted into real attachment. This attachment will be put to internal store and can be later retrieved using getTemporaryWebAttachment(String).

Parameters
stream attachment content
fileName name of attachment file
contentType content type
size size of attachment
target target for attachment - issue or project (in case if temporary attachment will be converted into real attachment during issue creation)
formToken token representing attachment group (usually a token for a web form)
user the author of attachment
Returns
  • created temporary attachment or error if creation failed

public Option<TemporaryWebAttachment> getTemporaryWebAttachment (String temporaryAttachmentId)

Gets temporary web attachment by string ID, which was produced by getStringId().

Parameters
temporaryAttachmentId string attachment ID
Returns
  • an option to temporary attachment - it will be empty if attachment was not found

public Collection<TemporaryWebAttachment> getTemporaryWebAttachmentsByFormToken (String formToken)

Gets all temporary attachments associated with given form token.

Parameters
formToken temporary attachments group token used during temporary attachments creation
Returns

public void updateTemporaryWebAttachment (String temporaryAttachmentId, TemporaryWebAttachment updated)

Updates existing temporary attachment object to new state. This may be useful to change attachment file name (for example if user may provide custom name).

Parameters
temporaryAttachmentId string id of temporary attachment to update
updated object that holds new values for the temporary attachment