Class DefaultTemporaryWebAttachmentManager
java.lang.Object
com.atlassian.jira.issue.attachment.DefaultTemporaryWebAttachmentManager
- All Implemented Interfaces:
InitializingComponent,TemporaryWebAttachmentManager
@ParametersAreNonnullByDefault
public class DefaultTemporaryWebAttachmentManager
extends Object
implements TemporaryWebAttachmentManager, InitializingComponent
Default implementation of TemporaryWebAttachmentManager.
- Since:
- v6.4
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTemporaryWebAttachmentManager(AttachmentManager attachmentManager, AttachmentValidator attachmentValidator, I18nHelper.BeanFactory beanFactory, TemporaryWebAttachmentsMonitorLocator temporaryWebAttachmentsMonitorLocator, TemporaryWebAttachmentFactory temporaryWebAttachmentsFactory, com.atlassian.cache.CacheManager cacheManager, ProjectManager projectManager, IssueManager issueManager, FeatureManager featureManager, AttachmentConfigStore attachmentConfigStore, StreamAttachmentStore streamAttachmentStore, AttachmentValidatorInvoker attachmentValidatorInvoker) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled after all the beans are constructed and the ApplicationContext is fully populated.booleancanGetTemporaryWebAttachment(String attachmentId, ApplicationUser user) voidclearTemporaryAttachmentsByFormToken(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.voidupdateTemporaryWebAttachment(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, TemporaryWebAttachmentFactory temporaryWebAttachmentsFactory, com.atlassian.cache.CacheManager cacheManager, ProjectManager projectManager, IssueManager issueManager, FeatureManager featureManager, AttachmentConfigStore attachmentConfigStore, StreamAttachmentStore streamAttachmentStore, AttachmentValidatorInvoker attachmentValidatorInvoker)
-
-
Method Details
-
afterInstantiation
Description copied from interface:InitializingComponentCalled after all the beans are constructed and the ApplicationContext is fully populated. Order of execution is order of bean creation, driven by InitializingComponentProcessor.- Specified by:
afterInstantiationin interfaceInitializingComponent- Throws:
Exception
-
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:TemporaryWebAttachmentManagerCreates 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:
createTemporaryWebAttachmentin 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:TemporaryWebAttachmentManagerGets temporary web attachment by string ID, which was produced byTemporaryWebAttachment.getStringId().- Specified by:
getTemporaryWebAttachmentin 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:TemporaryWebAttachmentManagerGets all temporary attachments associated with given form token.- Specified by:
getTemporaryWebAttachmentsByFormTokenin interfaceTemporaryWebAttachmentManager- Parameters:
formToken- temporary attachments group token used during temporary attachments creation- Returns:
- collection of matching
TemporaryWebAttachmentobjects
-
updateTemporaryWebAttachment
public void updateTemporaryWebAttachment(String temporaryAttachmentId, TemporaryWebAttachment updated) Description copied from interface:TemporaryWebAttachmentManagerUpdates 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:
updateTemporaryWebAttachmentin 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:TemporaryWebAttachmentManagerConverts 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:
convertTemporaryAttachmentsin 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:TemporaryWebAttachmentManagerRemoves all remaining temporary attachments which were created with given form token.- Specified by:
clearTemporaryAttachmentsByFormTokenin interfaceTemporaryWebAttachmentManager- Parameters:
formToken- form toke used to identify temporary attachments to remove
-