org.openmrs.validator
Class PatientValidator

java.lang.Object
  extended by org.openmrs.validator.PatientValidator
All Implemented Interfaces:
org.springframework.validation.Validator

public class PatientValidator
extends java.lang.Object
implements org.springframework.validation.Validator

This class validates a Patient object.


Constructor Summary
PatientValidator()
           
 
Method Summary
 boolean supports(java.lang.Class c)
          Returns whether or not this validator supports validating a given class.
 void validate(java.lang.Object obj, org.springframework.validation.Errors errors)
          Validates the given Patient.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatientValidator

public PatientValidator()
Method Detail

supports

public boolean supports(java.lang.Class c)
Returns whether or not this validator supports validating a given class.

Specified by:
supports in interface org.springframework.validation.Validator
Parameters:
c - The class to check for support.
See Also:
Validator.supports(java.lang.Class)

validate

public void validate(java.lang.Object obj,
                     org.springframework.validation.Errors errors)
Validates the given Patient. Currently just checks for errors in identifiers. TODO: Check for errors in all Patient fields.

Specified by:
validate in interface org.springframework.validation.Validator
Parameters:
obj - The patient to validate.
errors - Errors
See Also:
Validator.validate(java.lang.Object, org.springframework.validation.Errors)
Expected behavior:
fail validation if gender is blank, fail validation if birthdate makes patient older that 120 years old, fail validation if birthdate is a future date, fail validation if voidReason is blank when patient is voided, fail validation if causeOfDeath is blank when patient is dead

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change