Class DefaultAttachmentValidatorInvoker
java.lang.Object
com.atlassian.jira.issue.attachment.DefaultAttachmentValidatorInvoker
- All Implemented Interfaces:
AttachmentValidatorInvoker
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultAttachmentValidatorInvoker
(com.atlassian.plugin.PluginAccessor pluginAccessor) -
Method Summary
Modifier and TypeMethodDescriptionio.atlassian.fugue.Option
<AttachmentError> invokeAfterUploadValidators
(String fileName, io.atlassian.fugue.Either<Issue, Project> target, Function<AfterUploadAttachmentValidator, io.atlassian.util.concurrent.Promise<Optional<AttachmentValidationError>>> validation) Safely invoke pluggable after upload attachment validators, catching any exceptions on the way.io.atlassian.fugue.Option
<AttachmentError> invokeBeforeUploadValidators
(String fileName, io.atlassian.fugue.Either<Issue, Project> target, Function<BeforeUploadAttachmentValidator, Optional<AttachmentValidationError>> validation) Safely invoke pluggable before upload attachment validators, catching any exceptions on the way.
-
Constructor Details
-
DefaultAttachmentValidatorInvoker
public DefaultAttachmentValidatorInvoker(com.atlassian.plugin.PluginAccessor pluginAccessor)
-
-
Method Details
-
invokeBeforeUploadValidators
public io.atlassian.fugue.Option<AttachmentError> invokeBeforeUploadValidators(String fileName, io.atlassian.fugue.Either<Issue, Project> target, Function<BeforeUploadAttachmentValidator, Optional<AttachmentValidationError>> validation) Description copied from interface:AttachmentValidatorInvoker
Safely invoke pluggable before upload attachment validators, catching any exceptions on the way. Exceptions are logged and are treated as if the validator would pass.- Specified by:
invokeBeforeUploadValidators
in interfaceAttachmentValidatorInvoker
- Parameters:
fileName
- name of the file being processedtarget
- issue or project to which the file is being attachedvalidation
- validation function- Returns:
- optionally an attachment error (any encountered), or an empty option if all validators pass
-
invokeAfterUploadValidators
public io.atlassian.fugue.Option<AttachmentError> invokeAfterUploadValidators(String fileName, io.atlassian.fugue.Either<Issue, Project> target, Function<AfterUploadAttachmentValidator, io.atlassian.util.concurrent.Promise<Optional<AttachmentValidationError>>> validation) Description copied from interface:AttachmentValidatorInvoker
Safely invoke pluggable after upload attachment validators, catching any exceptions on the way. Exceptions are logged and are treated as if the validator would pass.validation
logic is expected to return an instance ofPromise
of validation result. This approach aims to support concurrent execution of validators. All promises will be converged into a single error (if any encountered, order of validation not guaranteed) or an emptyOption
.- Specified by:
invokeAfterUploadValidators
in interfaceAttachmentValidatorInvoker
- Parameters:
fileName
- name of the file being processedtarget
- issue or project to which the file is being attachedvalidation
- validation function- Returns:
- optionally an attachment error (any encountered), or an empty option if all validators pass
-