Class DefaultTemporaryWebAttachmentManager
java.lang.Object
com.atlassian.jira.issue.attachment.DefaultTemporaryWebAttachmentManager
- All Implemented Interfaces:
TemporaryWebAttachmentManager
@ParametersAreNonnullByDefault
public class DefaultTemporaryWebAttachmentManager
extends Object
implements TemporaryWebAttachmentManager
Default implementation of TemporaryWebAttachmentManager.
- Since:
- v6.4
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTemporaryWebAttachmentManager
(AttachmentManager attachmentManager, AttachmentValidator attachmentValidator, I18nHelper.BeanFactory beanFactory, TemporaryWebAttachmentsMonitorLocator temporaryWebAttachmentsMonitorLocator, ApplicationProperties applicationProperties, TemporaryWebAttachmentFactory temporaryWebAttachmentsFactory, com.atlassian.cache.CacheManager cacheManager, ProjectManager projectManager, IssueManager issueManager, FeatureManager featureManager, AttachmentConfigStore attachmentConfigStore, com.atlassian.plugin.PluginAccessor pluginAccessor, StreamAttachmentStore streamAttachmentStore) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canGetTemporaryWebAttachment
(String attachmentId, ApplicationUser user) void
clearTemporaryAttachmentsByFormToken
(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 byTemporaryWebAttachmentManager.createTemporaryWebAttachment(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.void
updateTemporaryWebAttachment
(String temporaryAttachmentId, TemporaryWebAttachment updated) Updates existing temporary attachment object to new state.
-
Constructor Details
-
DefaultTemporaryWebAttachmentManager
public DefaultTemporaryWebAttachmentManager(AttachmentManager attachmentManager, AttachmentValidator attachmentValidator, I18nHelper.BeanFactory beanFactory, TemporaryWebAttachmentsMonitorLocator temporaryWebAttachmentsMonitorLocator, ApplicationProperties applicationProperties, TemporaryWebAttachmentFactory temporaryWebAttachmentsFactory, com.atlassian.cache.CacheManager cacheManager, ProjectManager projectManager, IssueManager issueManager, FeatureManager featureManager, AttachmentConfigStore attachmentConfigStore, com.atlassian.plugin.PluginAccessor pluginAccessor, StreamAttachmentStore streamAttachmentStore)
-
-
Method Details
-
createTemporaryWebAttachment
@ParametersAreNonnullByDefault public 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) Description copied from interface:TemporaryWebAttachmentManager
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 usingTemporaryWebAttachmentManager.getTemporaryWebAttachment(java.lang.String)
.- Specified by:
createTemporaryWebAttachment
in interfaceTemporaryWebAttachmentManager
- 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
-
canGetTemporaryWebAttachment
-
getTemporaryWebAttachment
public io.atlassian.fugue.Option<TemporaryWebAttachment> getTemporaryWebAttachment(String temporaryAttachmentId) Description copied from interface:TemporaryWebAttachmentManager
Gets temporary web attachment by string ID, which was produced byTemporaryWebAttachment.getStringId()
.- Specified by:
getTemporaryWebAttachment
in interfaceTemporaryWebAttachmentManager
- Parameters:
temporaryAttachmentId
- string attachment ID- Returns:
- an option to temporary attachment - it will be empty if attachment was not found
-
getTemporaryWebAttachmentsByFormToken
Description copied from interface:TemporaryWebAttachmentManager
Gets all temporary attachments associated with given form token.- Specified by:
getTemporaryWebAttachmentsByFormToken
in interfaceTemporaryWebAttachmentManager
- Parameters:
formToken
- temporary attachments group token used during temporary attachments creation- Returns:
- collection of matching
TemporaryWebAttachment
objects
-
updateTemporaryWebAttachment
public void updateTemporaryWebAttachment(String temporaryAttachmentId, TemporaryWebAttachment updated) Description copied from interface:TemporaryWebAttachmentManager
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).- Specified by:
updateTemporaryWebAttachment
in interfaceTemporaryWebAttachmentManager
- Parameters:
temporaryAttachmentId
- string id of temporary attachment to updateupdated
- object that holds new values for the temporary attachment
-
convertTemporaryAttachments
public AttachmentsBulkOperationResult<ChangeItemBean> convertTemporaryAttachments(@Nullable ApplicationUser user, Issue issue, List<String> temporaryAttachmentsIds) Description copied from interface:TemporaryWebAttachmentManager
Converts temporary attachments created byTemporaryWebAttachmentManager.createTemporaryWebAttachment(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.- Specified by:
convertTemporaryAttachments
in interfaceTemporaryWebAttachmentManager
- Parameters:
user
- user which is performing conversionissue
- target issue for new attachmentstemporaryAttachmentsIds
- temporary attachments string IDs.- Returns:
- bulk operation result
-
clearTemporaryAttachmentsByFormToken
Description copied from interface:TemporaryWebAttachmentManager
Removes all remaining temporary attachments which were created with given form token.- Specified by:
clearTemporaryAttachmentsByFormToken
in interfaceTemporaryWebAttachmentManager
- Parameters:
formToken
- form toke used to identify temporary attachments to remove
-