Interface AttachmentValidatorInvoker

All Known Implementing Classes:
DefaultAttachmentValidatorInvoker

public interface AttachmentValidatorInvoker
  • Method Details

    • invokeBeforeUploadValidators

      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. Exceptions are logged and are treated as if the validator would pass.
      Parameters:
      fileName - name of the file being processed
      target - issue or project to which the file is being attached
      validation - validation function
      Returns:
      optionally an attachment error (any encountered), or an empty option if all validators pass
    • invokeAfterUploadValidators

      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)
      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 of Promise 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 empty Option.

      Parameters:
      fileName - name of the file being processed
      target - issue or project to which the file is being attached
      validation - validation function
      Returns:
      optionally an attachment error (any encountered), or an empty option if all validators pass
    • createAttachmentError

      static io.atlassian.fugue.Option<AttachmentError> createAttachmentError(String fileName, String logMessage, String localizedMessage, ErrorCollection.Reason reason)