org.openmrs.validator
Class ConceptValidator

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

@Handler(supports=Concept.class,
         order=50)
public class ConceptValidator
extends java.lang.Object
implements org.springframework.validation.Validator

Validates Concept objects.


Constructor Summary
ConceptValidator()
           
 
Method Summary
 boolean supports(java.lang.Class c)
          Determines if the command object being submitted is a valid type
 void validate(java.lang.Object obj, org.springframework.validation.Errors errors)
          Checks that a given concept object is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConceptValidator

public ConceptValidator()
Method Detail

supports

public boolean supports(java.lang.Class c)
Determines if the command object being submitted is a valid type

Specified by:
supports in interface org.springframework.validation.Validator
See Also:
Validator.supports(java.lang.Class)

validate

public void validate(java.lang.Object obj,
                     org.springframework.validation.Errors errors)
              throws APIException,
                     DuplicateConceptNameException
Checks that a given concept object is valid.

Specified by:
validate in interface org.springframework.validation.Validator
Throws:
APIException
DuplicateConceptNameException
See Also:
Validator.validate(java.lang.Object, org.springframework.validation.Errors)
Expected behavior:
pass if the concept has atleast one fully specified name added to it, fail if there is a duplicate unretired concept name in the locale, fail if there is a duplicate unretired preferred name in the same locale, fail if there is a duplicate unretired fully specified name in the same locale, fail if any names in the same locale for this concept are similar, pass if the concept with a duplicate name is retired, pass if the concept being validated is retired and has a duplicate name, fail if any name is an empty string, fail if the object parameter is null, pass if the concept is being updated with no name change, fail if any name is a null value, not allow multiple preferred names in a given locale, not allow multiple fully specified conceptNames in a given locale, not allow multiple short names in a given locale, not allow an index term to be a locale preferred name, fail if there is no name explicitly marked as fully specified, pass if the duplicate ConceptName is neither preferred nor fully Specified

OpenMRS-1.7.x

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