@Component(value="allergyValidator") @Handler(supports=Allergy.class, order=50) public class AllergyValidator extends Object implements org.springframework.validation.Validator
Constructor and Description |
---|
AllergyValidator() |
Modifier and Type | Method and Description |
---|---|
boolean |
supports(Class<?> clazz) |
void |
validate(Object target,
org.springframework.validation.Errors errors) |
public boolean supports(Class<?> clazz)
supports
in interface org.springframework.validation.Validator
public void validate(Object target, org.springframework.validation.Errors errors)
validate
in interface org.springframework.validation.Validator
target
- errors
- Should fail for a null value
Should fail if patient is null
Should fail id allergenType is null
Should fail if allergen is null
Should fail if codedAllergen is null
Should fail if nonCodedAllergen is null and allergen is set to other non coded
Should reject a duplicate allergen
Should reject a duplicate non coded allergen
Should pass for a valid allergy
Should reject numeric values and symbols on reactionNonCodedValidator.validate(Object, org.springframework.validation.Errors)
Copyright © 2024 OpenMRS Inc.. All rights reserved.