@Handler(supports=PatientIdentifier.class, order=50) public class PatientIdentifierValidator extends Object implements org.springframework.validation.Validator
Constructor and Description |
---|
PatientIdentifierValidator() |
Modifier and Type | Method and Description |
---|---|
static void |
checkIdentifierAgainstFormat(String identifier,
String format)
Validates that a given identifier string is valid for a given regular expression format
|
static void |
checkIdentifierAgainstValidator(String identifier,
IdentifierValidator validator)
Validates that a given identifier string is valid for a given IdentifierValidator
|
boolean |
supports(Class c) |
void |
validate(Object obj,
org.springframework.validation.Errors errors)
Validates a PatientIdentifier.
|
static void |
validateIdentifier(PatientIdentifier pi)
Checks that the given
PatientIdentifier is valid |
static void |
validateIdentifier(String identifier,
PatientIdentifierType pit)
Validates that a given identifier string is valid for a given
PatientIdentifierType
Checks for things like blank identifiers, invalid check digits, and invalid format. |
public boolean supports(Class c)
supports
in interface org.springframework.validation.Validator
Validator.supports(java.lang.Class)
public void validate(Object obj, org.springframework.validation.Errors errors)
validate
in interface org.springframework.validation.Validator
Validator.validate(java.lang.Object,
org.springframework.validation.Errors)
public static void validateIdentifier(PatientIdentifier pi) throws PatientIdentifierException
PatientIdentifier
is validpi
- - the PatientIdentifier
to validatePatientIdentifierException
- if the PatientIdentifier
is invalidvalidateIdentifier(String, PatientIdentifierType)
public static void validateIdentifier(String identifier, PatientIdentifierType pit) throws PatientIdentifierException
PatientIdentifierType
Checks for things like blank identifiers, invalid check digits, and invalid format.pit
- - the PatientIdentifierType
to validate againstidentifier
- - the identifier to check against the passed PatientIdentifierType
PatientIdentifierException
- if the identifier is invalidcheckIdentifierAgainstFormat(String, String)
,
checkIdentifierAgainstValidator(String, IdentifierValidator)
public static void checkIdentifierAgainstFormat(String identifier, String format) throws PatientIdentifierException
format
- - the regular expression format to validate againstidentifier
- - the identifier to check against the passed PatientIdentifierType
PatientIdentifierException
- if the identifier is does not match the formatpublic static void checkIdentifierAgainstValidator(String identifier, IdentifierValidator validator) throws PatientIdentifierException
identifier
- the identifier to check against the passed PatientIdentifierType
validator
- the IdentifierValidator to use to check the identifierPatientIdentifierException
- if the identifier is does not match the formatCopyright © 2018 OpenMRS LLC.. All Rights Reserved.