@PublicApi @ParametersAreNonnullByDefault public interface

TemporaryWebAttachmentManager

com.atlassian.jira.issue.attachment.TemporaryWebAttachmentManager
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

Manager for temporary web attachments.

Summary

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.
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.

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

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