Class GenericConditionValidator
java.lang.Object
ch.tocco.nice2.persist.core.api.validation.AbstractEntitiesValidator
ch.tocco.nice2.persist.core.api.validation.GenericConditionValidator
- All Implemented Interfaces:
EntitiesValidator
The validator checks if a condition is valid for a list of entities. The following arguments are configurable:
- entity (required): entity name on which the validator runs
- condition (required): field on the entity where the tql condition is defined
- entityField: field which describes (as a comma separated list) for which entities the condition should be validated Example: "entity_model" or "relConfig.entity"
- entityStatic: if the condition should be checked on a static (at compile time defined) list of entities (and not be configurable per entity instance as a field)
@Bean
public EntitiesValidatorContribution genericConditionValidatorContribution(GenericConditionValidator validator) {
EntitiesValidatorContribution bean = new EntitiesValidatorContribution();
bean.setValidator(validator);
bean.setFilter("Entity_folder_template");
return bean;
}
@Bean
public EntityConditionContribution entityFolderTemplateConditionContribution() {
EntityConditionContribution contribution = new EntityConditionContribution();
contribution.setEntity("Entity_folder_template");
contribution.setEntityField("entity_model");
contribution.setConditionField("condition");
return contribution;
}
-
Constructor Summary
ConstructorDescriptionGenericConditionValidator
(org.slf4j.Logger logger, PersistenceService persistenceService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
setDefinitions
(List<EntityConditionContribution> definitions) void
Validate all entities (of one entity model) that where changed in a transactionMethods inherited from class ch.tocco.nice2.persist.core.api.validation.AbstractEntitiesValidator
addMyself, getName
-
Constructor Details
-
GenericConditionValidator
-
-
Method Details
-
validate
Description copied from interface:EntitiesValidator
Validate all entities (of one entity model) that where changed in a transaction- Parameters:
entities
- the entities to be validatedvalidationResults
- a map of EntityValidationResults, contains anEntityValidationResult
for each entity. SeeEntityValidationResult
for more details on how to use the EntityValidationResult
-
setDefinitions
@Autowired(required=false) public void setDefinitions(List<EntityConditionContribution> definitions)
-