Interface TemporaryWebAttachmentManager
- All Known Implementing Classes:
DefaultTemporaryWebAttachmentManager
@PublicApi
@ParametersAreNonnullByDefault
public interface TemporaryWebAttachmentManager
Manager for temporary web attachments.
- Since:
- v6.4
-
Method Summary
Modifier and TypeMethodDescriptionvoidclearTemporaryAttachmentsByFormToken(String formToken) Removes all remaining temporary attachments which were created with given form token.convertTemporaryAttachments(ApplicationUser user, Issue issue, List<String> temporaryAttachmentsIds) Converts temporary attachments created bycreateTemporaryWebAttachment(java.io.InputStream, java.lang.String, java.lang.String, long, io.atlassian.fugue.Either<com.atlassian.jira.issue.Issue, com.atlassian.jira.project.Project>, java.lang.String, com.atlassian.jira.user.ApplicationUser)into real attachments.io.atlassian.fugue.Either<AttachmentError,TemporaryWebAttachment> createTemporaryWebAttachment(InputStream stream, String fileName, String contentType, long size, io.atlassian.fugue.Either<Issue, Project> target, String formToken, ApplicationUser user) Creates new temporary attachment that may be later converted into real attachment.io.atlassian.fugue.Option<TemporaryWebAttachment>getTemporaryWebAttachment(String temporaryAttachmentId) Gets temporary web attachment by string ID, which was produced byTemporaryWebAttachment.getStringId().getTemporaryWebAttachmentsByFormToken(String formToken) Gets all temporary attachments associated with given form token.voidupdateTemporaryWebAttachment(String temporaryAttachmentId, TemporaryWebAttachment updated) Updates existing temporary attachment object to new state.
-
Method Details
-
createTemporaryWebAttachment
io.atlassian.fugue.Either<AttachmentError,TemporaryWebAttachment> createTemporaryWebAttachment(InputStream stream, String fileName, String contentType, long size, io.atlassian.fugue.Either<Issue, Project> target, String formToken, @Nullable 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 usinggetTemporaryWebAttachment(java.lang.String).- Parameters:
stream- attachment contentfileName- name of attachment filecontentType- content typesize- size of attachmenttarget- 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
-
getTemporaryWebAttachment
io.atlassian.fugue.Option<TemporaryWebAttachment> getTemporaryWebAttachment(String temporaryAttachmentId) Gets temporary web attachment by string ID, which was produced byTemporaryWebAttachment.getStringId().- Parameters:
temporaryAttachmentId- string attachment ID- Returns:
- an option to temporary attachment - it will be empty if attachment was not found
-
getTemporaryWebAttachmentsByFormToken
Gets all temporary attachments associated with given form token.- Parameters:
formToken- temporary attachments group token used during temporary attachments creation- Returns:
- collection of matching
TemporaryWebAttachmentobjects
-
updateTemporaryWebAttachment
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 updateupdated- object that holds new values for the temporary attachment- Throws:
NoSuchElementException
-
convertTemporaryAttachments
AttachmentsBulkOperationResult<ChangeItemBean> convertTemporaryAttachments(@Nullable ApplicationUser user, Issue issue, List<String> temporaryAttachmentsIds) Converts temporary attachments created bycreateTemporaryWebAttachment(java.io.InputStream, java.lang.String, java.lang.String, long, io.atlassian.fugue.Either<com.atlassian.jira.issue.Issue, com.atlassian.jira.project.Project>, java.lang.String, com.atlassian.jira.user.ApplicationUser)into real attachments.- Parameters:
user- user which is performing conversionissue- target issue for new attachmentstemporaryAttachmentsIds- temporary attachments string IDs.- Returns:
- bulk operation result
-
clearTemporaryAttachmentsByFormToken
Removes all remaining temporary attachments which were created with given form token.- Parameters:
formToken- form toke used to identify temporary attachments to remove
-