Interface CommentsPerIssueLimitValidator

All Known Implementing Classes:
DefaultCommentsPerIssueLimitValidator

@ExperimentalApi public interface CommentsPerIssueLimitValidator
Validates if the comments per issue limit is not reached.
Since:
9.0.0
  • Method Details

    • isValid

      boolean isValid(@Nonnull Issue issue, @Nullable ApplicationUser author, @Nonnull String commentBody, @Nonnull ErrorCollection errorCollection)
      Checks if limit is not reached yet (eg. to determine if new entity can be created). If validation fails, an error with description is added to error collection.
      Parameters:
      issue - entity analysed for comment number
      author - comment creator
      commentBody - comment body
      Returns:
      true if limit is not reached
    • getInvalidIssues

      @Nonnull List<Issue> getInvalidIssues(@Nonnull List<Issue> issues)
      Validates comment limits for all provided issues and returns issues that failed. This method is a recommended way to validate a collection of issues due to performance optimizations. This method doesn't trigger any notification or logging.
      Parameters:
      issues - list of issues
      Returns:
      list of issues for which validation failed
    • validate

      void validate(@Nonnull Issue issue, @Nullable ApplicationUser author, @Nonnull String commentBody) throws CommentsPerIssueLimitExceededException
      Checks if limit is not reached yet (eg. to determine if new entity can be created).
      Parameters:
      issue - entity analysed for comment number
      author - comment creator
      commentBody - comment body
      Throws:
      CommentsPerIssueLimitExceededException - if validation fails
    • getLimit

      long getLimit()
      Returns the value of the limit as configured at the time of calling,
      Returns:
      the configured limit