@Handler(supports=Provider.class, order=50) public class ProviderValidator extends BaseCustomizableValidator implements org.springframework.validation.Validator
Encounter
classConstructor and Description |
---|
ProviderValidator() |
Modifier and Type | Method and Description |
---|---|
boolean |
supports(Class<?> c)
Returns whether or not this validator supports validating a given class.
|
void |
validate(Object obj,
org.springframework.validation.Errors errors)
Validates the given Provider. checks to see if a provider is valid (Either of Person or
Provider name should be set and not both) Checks to see if there is a retired Reason in case
a provider is retired
|
validateAttributes
public boolean supports(Class<?> c)
supports
in interface org.springframework.validation.Validator
c
- The class to check for support.Validator.supports(java.lang.Class)
public void validate(Object obj, org.springframework.validation.Errors errors) throws APIException
validate
in interface org.springframework.validation.Validator
obj
- The encounter to validate.errors
- ErrorsAPIException
Should be valid if identifier is not set
Should be valid if identifier is set
Should be invalid if provider is retired and the retired reason is not mentioned
Should be invalid if person is not set
Should be valid if only person is set
Should reject a provider if it has fewer than min occurs of an attribute
Should reject a provider if it has more than max occurs of an attribute
Should accept duplicate identifier if the existing provider is not retired
Should accept duplicate identifier if the existing provider is retired
Should accept a duplicate identifier for a new provider which is not retired
Should accept a duplicate identifier for a new provider which is retired
Should pass validation if field lengths are correct
Should fail validation if field lengths are not correct
Copyright © 2024 OpenMRS Inc.. All rights reserved.