Class StandardMandatoryGroupValidator
java.lang.Object
ch.tocco.nice2.persist.core.api.validation.AbstractEntityValidator
ch.tocco.nice2.persist.core.impl.validation.StandardMandatoryGroupValidator
- All Implemented Interfaces:
EntitiesValidator, EntityValidator
Checks if either non or all of the fields are filled out
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddMyself(EntityModel model) Implement this method to return true if the Validator should add itself to the EntityModel at hand.voidsetGroups(List<StandardMandatoryGroupValidatorContribution> contributions) voidvalidate(Entity entity, EntityValidationResult validationResult) Validate the entity at hand.Methods inherited from class AbstractEntityValidator
getNameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EntityValidator
validate
-
Field Details
-
ERROR_MESSAGE_ID
- See Also:
-
ERROR_MESSAGE_VAR_FIELDS
- See Also:
-
ERROR_MESSAGE_SEPARATOR
public static final com.google.common.base.Joiner ERROR_MESSAGE_SEPARATOR -
TEXT_RESOURCE_FIELD_FORMAT
- See Also:
-
ERROR_MESSAGE_FIELD_FORMAT
- See Also:
-
-
Constructor Details
-
StandardMandatoryGroupValidator
-
-
Method Details
-
validate
public void validate(Entity entity, EntityValidationResult validationResult) throws PersistException Description copied from interface:EntityValidatorValidate the entity at hand.- Parameters:
entity- the entity to be validatedvalidationResult- the EntityValidationResult to write the result of the validation to.EntityValidationResultfor more details on how to construct the EntityValidationResult.- Throws:
PersistException
-
setGroups
@Autowired(required=false) public void setGroups(List<StandardMandatoryGroupValidatorContribution> contributions) -
addMyself
Description copied from interface:EntitiesValidatorImplement this method to return true if the Validator should add itself to the EntityModel at hand. This method can be useful, if a validator is being used for all models meeting a certain requirement (e.g. model has a field of type X, entity is a lookup entity, etc.). The method is called for each entity model at application startup when building the entity model.- Specified by:
addMyselfin interfaceEntitiesValidator- Overrides:
addMyselfin classAbstractEntityValidator- Parameters:
model- the EntityModel- Returns:
- true to add the Validator to the EntityModel at hand
-