Interface ManagementContractValidator
-
- All Superinterfaces:
GenericContractValidator<ManagementContractModel>
- 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 ManagementContractValidator extends GenericContractValidator<ManagementContractModel>
Used to validate contracts (any class that extends AbstractContractModel) and to apply acceptance rules. Bellow the example of usage :private static GenericContractValidator checkDuplicateInDatabaseValidator() { return (contract, contractName) -> { GenericRejectionCause rejection = null; boolean exist = ... exists in database?; if (exist) { rejection = GenericRejectionCause.rejectDuplicatedInDatabase(contractName); } return (rejection == null) ? Optional.empty() : Optional.of(rejection); }; }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface fr.gouv.vitam.functional.administration.contract.core.GenericContractValidator
GenericContractValidator.GenericRejectionCause
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<GenericContractValidator.GenericRejectionCause>
validate(ManagementContractModel managementContract, java.lang.String contractName)
Validate a contract object
-
-
-
Method Detail
-
validate
java.util.Optional<GenericContractValidator.GenericRejectionCause> validate(ManagementContractModel managementContract, java.lang.String contractName)
Validate a contract object- Specified by:
validate
in interfaceGenericContractValidator<ManagementContractModel>
- Parameters:
managementContract
- to validatecontractName
-- Returns:
- empty optional if OK, Else return the rejection cause
-
-