Search in sources :

Example 1 with BlockOverrideError

use of org.folio.circulation.support.http.server.BlockOverrideError in project mod-circulation by folio-org.

the class OverridingErrorHandler method extendOverridableErrors.

private ValidationErrorFailure extendOverridableErrors(ValidationErrorFailure validationFailure) {
    final CirculationErrorType errorType = getErrors().get(validationFailure);
    if (!OVERRIDABLE_ERROR_TYPES.containsKey(errorType)) {
        return validationFailure;
    }
    OverridableBlockType blockType = OVERRIDABLE_ERROR_TYPES.get(errorType);
    OkapiPermissions missingOverridePermissions = blockType.getMissingOverridePermissions(okapiPermissions);
    return new ValidationErrorFailure(validationFailure.getErrors().stream().map(error -> new BlockOverrideError(error, blockType, missingOverridePermissions)).collect(toList()));
}
Also used : OverridableBlockType(org.folio.circulation.domain.override.OverridableBlockType) OkapiPermissions(org.folio.circulation.support.http.OkapiPermissions) ValidationErrorFailure(org.folio.circulation.support.ValidationErrorFailure) BlockOverrideError(org.folio.circulation.support.http.server.BlockOverrideError)

Aggregations

OverridableBlockType (org.folio.circulation.domain.override.OverridableBlockType)1 ValidationErrorFailure (org.folio.circulation.support.ValidationErrorFailure)1 OkapiPermissions (org.folio.circulation.support.http.OkapiPermissions)1 BlockOverrideError (org.folio.circulation.support.http.server.BlockOverrideError)1