org.kuali.student.common.validator
Class ValidatorUtils

java.lang.Object
  extended by org.kuali.student.common.validator.ValidatorUtils

public class ValidatorUtils
extends Object


Constructor Summary
ValidatorUtils()
           
 
Method Summary
static boolean compareValues(Object value1, Object value2, DataType dataType, String operator, boolean isCaseSensitive, DateParser dateParser)
           
static Boolean getBoolean(Object o)
           
static Date getDate(Object o, DateParser dateParser)
           
static Double getDouble(Object o)
           
static FieldDefinition getField(String key, ObjectStructureDefinition objStructure)
          Traverses the dictionary ObjectStructure to find the field with the match key, type and state The key has to relative to the current object structure that is being traversed.
static Float getFloat(Object o)
           
static Integer getInteger(Object o)
           
static Long getLong(Object o)
           
private static String[] getPathTokens(String fieldPath)
           
static String getString(Object o)
           
static boolean hasErrors(List<ValidationResultInfo> validationResults)
          Inspect the validation result to determine if there are any errors.
static boolean hasWarnings(List<ValidationResultInfo> validationResults)
          Inspect the validation result to determine if there are any errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatorUtils

public ValidatorUtils()
Method Detail

compareValues

public static boolean compareValues(Object value1,
                                    Object value2,
                                    DataType dataType,
                                    String operator,
                                    boolean isCaseSensitive,
                                    DateParser dateParser)

getInteger

public static Integer getInteger(Object o)

getLong

public static Long getLong(Object o)

getFloat

public static Float getFloat(Object o)

getDouble

public static Double getDouble(Object o)

getDate

public static Date getDate(Object o,
                           DateParser dateParser)

getString

public static String getString(Object o)

getBoolean

public static Boolean getBoolean(Object o)

getField

public static FieldDefinition getField(String key,
                                       ObjectStructureDefinition objStructure)
Traverses the dictionary ObjectStructure to find the field with the match key, type and state The key has to relative to the current object structure that is being traversed. example: current object structure is ActivityInfo and if we want to lookup the academicSubjectorgId, then The current object structure starts from the field on which the constraint is applied on. If we want to address fields outside of this object structure we ll need to pass in the dictionary context.

Parameters:
key -
type -
state -
objStructure -
Returns:

getPathTokens

private static String[] getPathTokens(String fieldPath)

hasErrors

public static boolean hasErrors(List<ValidationResultInfo> validationResults)
Inspect the validation result to determine if there are any errors.

Parameters:
validationResults -
Returns:
true if at least one validation result is an error.

hasWarnings

public static boolean hasWarnings(List<ValidationResultInfo> validationResults)
Inspect the validation result to determine if there are any errors.

Parameters:
validationResults -
Returns:
true if at least one validation result is an error.


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.