Interface ArchiveUnitProfileValidator
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ArchiveUnitProfileValidatorUsed to validate archive unit profiles and to apply acceptance rules. Bellow the example of usage :
The call the method like this to validate the archive unit profile aup: GenericRejectionCause rejection = checkDuplicateInDatabaseValidator().validate(aup, aup.getName()); Check if rejection is present then do the resolutionprivate static ArchiveUnitProfileValidator checkDuplicateInDatabaseValidator() { return (profile, profileIdentifier) -> { GenericRejectionCause rejection = null; boolean exist = ... exists in database?; if (exist) { rejection = GenericRejectionCause.rejectDuplicatedInDatabase(profileIdentifier); } return (rejection == null) ? Optional.empty() : Optional.of(rejection); }; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classArchiveUnitProfileValidator.RejectionCauseRejection Cause
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<ArchiveUnitProfileValidator.RejectionCause>validate(ArchiveUnitProfileModel profile)Validate an archive unit profile object
-
-
-
Method Detail
-
validate
java.util.Optional<ArchiveUnitProfileValidator.RejectionCause> validate(ArchiveUnitProfileModel profile)
Validate an archive unit profile object- Parameters:
profile- to validate- Returns:
- empty optional if OK, Else return the rejection cause
-
-