@Handler(supports=PatientIdentifier.class, order=50) public class PatientIdentifierValidator extends java.lang.Object implements org.springframework.validation.Validator
Constructor and Description |
---|
PatientIdentifierValidator() |
Modifier and Type | Method and Description |
---|---|
static void |
checkIdentifierAgainstFormat(java.lang.String identifier,
java.lang.String format)
Validates that a given identifier string is valid for a given regular expression format
|
static void |
checkIdentifierAgainstValidator(java.lang.String identifier,
IdentifierValidator validator)
Validates that a given identifier string is valid for a given IdentifierValidator
|
boolean |
supports(java.lang.Class c) |
void |
validate(java.lang.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(java.lang.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(java.lang.Class c)
supports
in interface org.springframework.validation.Validator
Validator.supports(java.lang.Class)
public void validate(java.lang.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(java.lang.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(java.lang.String identifier, java.lang.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(java.lang.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 Inc.. All Rights Reserved.