Search in sources :

Example 1 with UserManualBlocksValidator

use of org.folio.circulation.domain.validation.UserManualBlocksValidator in project mod-circulation by folio-org.

the class RenewalResource method createManualPatronBlocksValidator.

private Validator<RenewalContext> createManualPatronBlocksValidator(JsonObject request, OkapiPermissions permissions, Clients clients) {
    Function<RenewalContext, CompletableFuture<Result<RenewalContext>>> validationFunction = new UserManualBlocksValidator(clients)::refuseWhenUserIsBlocked;
    final BlockOverrides blockOverrides = getOverrideBlocks(request);
    return blockOverrides.getPatronBlockOverride().isRequested() ? new OverridingBlockValidator<>(PATRON_BLOCK, blockOverrides, permissions) : new BlockValidator<>(USER_IS_BLOCKED_MANUALLY, validationFunction);
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) UserManualBlocksValidator(org.folio.circulation.domain.validation.UserManualBlocksValidator) BlockOverrides(org.folio.circulation.domain.override.BlockOverrides) RenewalContext(org.folio.circulation.resources.context.RenewalContext)

Aggregations

CompletableFuture (java.util.concurrent.CompletableFuture)1 BlockOverrides (org.folio.circulation.domain.override.BlockOverrides)1 UserManualBlocksValidator (org.folio.circulation.domain.validation.UserManualBlocksValidator)1 RenewalContext (org.folio.circulation.resources.context.RenewalContext)1