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 Summary
Modifier and TypeMethodDescriptiongetInvalidIssues(List<Issue> issues) Validates comment limits for all provided issues and returns issues that failed.longgetLimit()Returns the value of the limit as configured at the time of calling,booleanisValid(Issue issue, ApplicationUser author, String commentBody, ErrorCollection errorCollection) Checks if limit is not reached yet (eg.voidvalidate(Issue issue, ApplicationUser author, String commentBody) Checks if limit is not reached yet (eg.
-
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 numberauthor- comment creatorcommentBody- comment body- Returns:
- true if limit is not reached
-
getInvalidIssues
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 numberauthor- comment creatorcommentBody- 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
-