org.kuali.student.r2.common.validator
Class DefaultValidatorImpl
java.lang.Object
org.kuali.student.r2.common.validator.BaseAbstractValidator
org.kuali.student.r2.common.validator.DefaultValidatorImpl
- All Implemented Interfaces:
- Validator
- Direct Known Subclasses:
- ActiveDatesValidator, ActivityTypeValidator, ExpenditurePercentValidator, NoOpDefaultValidatorImpl, ProgramManagingBodiesValidator, RevenuePercentValidator, SubjectAreaUnitOwnerValidator
public class DefaultValidatorImpl
- extends BaseAbstractValidator
Method Summary |
protected void |
addCrossFieldWarning(List<ValidationResultInfo> valResults,
String crossFieldPath,
String message,
ValidationResult.ErrorLevel errorLevel)
|
DateParser |
getDateParser()
|
protected String |
getElementXpath(Stack<String> elementStack)
|
protected String |
getMessage(String messageId,
ContextInfo contextInfo)
|
String |
getMessageGroupKey()
|
String |
getMessageLocaleKey()
|
MessageService |
getMessageService()
|
SearchDispatcher |
getSearchDispatcher()
|
protected boolean |
hasText(String string)
|
boolean |
isServerSide()
|
protected void |
processBaseConstraints(List<ValidationResultInfo> valResults,
Constraint constraint,
FieldDefinition field,
Object value,
Stack<String> elementStack,
ContextInfo contextInfo)
|
protected Constraint |
processCaseConstraint(List<ValidationResultInfo> valResults,
CaseConstraint caseConstraint,
ObjectStructureDefinition objStructure,
Object value,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure,
ContextInfo contextInfo)
Process caseConstraint tag and sets any of the base constraint items if any of the when condition matches |
protected void |
processConstraint(List<ValidationResultInfo> valResults,
FieldDefinition field,
ObjectStructureDefinition objStructure,
Object value,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure,
ContextInfo contextInfo)
|
protected void |
processCrossFieldWarning(List<ValidationResultInfo> valResults,
CaseConstraint crossConstraint,
Constraint constraint,
Object value,
ValidationResult.ErrorLevel errorLevel,
ContextInfo contextInfo)
This adds a warning on the related field when a processed case-constraint results in a warning |
protected void |
processCrossFieldWarning(List<ValidationResultInfo> valResults,
LookupConstraint lookupConstraint,
ValidationResult.ErrorLevel errorLevel,
ContextInfo contextInfo)
This adds a warning on the related field when a processed lookup-constraint results in a warning |
protected void |
processCrossFieldWarning(List<ValidationResultInfo> valResults,
RequiredConstraint requiredConstraint,
ValidationResult.ErrorLevel errorLevel,
String field,
ContextInfo contextInfo)
This adds a warning on the related field when a processed case-constraint results in a warning |
protected void |
processLookupConstraint(List<ValidationResultInfo> valResults,
LookupConstraint lookupConstraint,
FieldDefinition field,
Stack<String> elementStack,
ConstraintDataProvider dataProvider,
ObjectStructureDefinition objStructure,
Object rootData,
ObjectStructureDefinition rootObjStructure,
Object value,
ContextInfo contextInfo)
|
protected void |
processNestedObjectStructure(List<ValidationResultInfo> results,
Object value,
ObjectStructureDefinition nestedObjStruct,
FieldDefinition field,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure,
ContextInfo contextInfo)
|
protected ValidationResultInfo |
processOccursConstraint(String element,
MustOccurConstraint constraint,
FieldDefinition field,
ObjectStructureDefinition objStructure,
ConstraintDataProvider dataProvider,
ContextInfo contextInfo)
Computes if all the filed required in the occurs clause are between the min and max |
protected ValidationResultInfo |
processRequireConstraint(String element,
RequiredConstraint constraint,
FieldDefinition field,
ObjectStructureDefinition objStructure,
ConstraintDataProvider dataProvider,
ContextInfo contextInfo)
|
ValidationResultInfo |
processValidCharConstraint(String element,
ValidCharsConstraint vcConstraint,
ConstraintDataProvider dataProvider,
Object value,
ContextInfo contextInfo)
|
void |
setDateParser(DateParser dateParser)
|
void |
setMessageGroupKey(String messageGroupKey)
|
void |
setMessageLocaleKey(String messageLocaleKey)
|
void |
setMessageService(MessageService messageService)
|
void |
setSearchDispatcher(SearchDispatcher searchDispatcher)
|
void |
setServerSide(boolean serverSide)
|
protected Map<String,Object> |
toMap(Constraint c)
|
protected Integer |
tryParse(String s)
|
protected void |
validateBoolean(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
|
protected void |
validateDate(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
DateParser dateParser,
ContextInfo contextInfo)
|
protected void |
validateDouble(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
|
void |
validateField(List<ValidationResultInfo> results,
FieldDefinition field,
ObjectStructureDefinition objStruct,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjectStructure,
ContextInfo contextInfo)
|
protected void |
validateFloat(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
|
protected void |
validateInteger(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
|
protected void |
validateLong(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
|
List<ValidationResultInfo> |
validateObject(FieldDefinition field,
Object o,
ObjectStructureDefinition objStructure,
Stack<String> elementStack,
ContextInfo contextInfo)
|
List<ValidationResultInfo> |
validateObject(Object data,
ObjectStructureDefinition objStructure,
ContextInfo contextInfo)
Validate Object and all its nested child objects for given type and state |
protected void |
validateString(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultValidatorImpl
public DefaultValidatorImpl()
getMessageService
public MessageService getMessageService()
setMessageService
public void setMessageService(MessageService messageService)
getMessageLocaleKey
public String getMessageLocaleKey()
setMessageLocaleKey
public void setMessageLocaleKey(String messageLocaleKey)
getMessageGroupKey
public String getMessageGroupKey()
setMessageGroupKey
public void setMessageGroupKey(String messageGroupKey)
setDateParser
public void setDateParser(DateParser dateParser)
isServerSide
public boolean isServerSide()
- Returns:
- the serverSide
setServerSide
public void setServerSide(boolean serverSide)
- Parameters:
serverSide
- the serverSide to set
getDateParser
public DateParser getDateParser()
- Returns:
- the dateParser
validateObject
public List<ValidationResultInfo> validateObject(Object data,
ObjectStructureDefinition objStructure,
ContextInfo contextInfo)
- Validate Object and all its nested child objects for given type and state
- Specified by:
validateObject
in interface Validator
- Specified by:
validateObject
in class BaseAbstractValidator
- Parameters:
data
- objStructure
-
- Returns:
- See Also:
org.kuali.student.r1.common.validator.Validator#validateObject(java.lang.Object, org.kuali.student.common.dictionary.dto.ObjectStructureDefinition)
validateField
public void validateField(List<ValidationResultInfo> results,
FieldDefinition field,
ObjectStructureDefinition objStruct,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjectStructure,
ContextInfo contextInfo)
tryParse
protected Integer tryParse(String s)
processNestedObjectStructure
protected void processNestedObjectStructure(List<ValidationResultInfo> results,
Object value,
ObjectStructureDefinition nestedObjStruct,
FieldDefinition field,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure,
ContextInfo contextInfo)
processConstraint
protected void processConstraint(List<ValidationResultInfo> valResults,
FieldDefinition field,
ObjectStructureDefinition objStructure,
Object value,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure,
ContextInfo contextInfo)
processRequireConstraint
protected ValidationResultInfo processRequireConstraint(String element,
RequiredConstraint constraint,
FieldDefinition field,
ObjectStructureDefinition objStructure,
ConstraintDataProvider dataProvider,
ContextInfo contextInfo)
processCaseConstraint
protected Constraint processCaseConstraint(List<ValidationResultInfo> valResults,
CaseConstraint caseConstraint,
ObjectStructureDefinition objStructure,
Object value,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure,
ContextInfo contextInfo)
- Process caseConstraint tag and sets any of the base constraint items if any of the when condition matches
- Parameters:
caseConstraint
- caseConstraint
- field
-
processValidCharConstraint
public ValidationResultInfo processValidCharConstraint(String element,
ValidCharsConstraint vcConstraint,
ConstraintDataProvider dataProvider,
Object value,
ContextInfo contextInfo)
processOccursConstraint
protected ValidationResultInfo processOccursConstraint(String element,
MustOccurConstraint constraint,
FieldDefinition field,
ObjectStructureDefinition objStructure,
ConstraintDataProvider dataProvider,
ContextInfo contextInfo)
- Computes if all the filed required in the occurs clause are between the min and max
- Parameters:
valResults
- constraint
- field
- type
- state
- objStructure
- dataProvider
-
- Returns:
processLookupConstraint
protected void processLookupConstraint(List<ValidationResultInfo> valResults,
LookupConstraint lookupConstraint,
FieldDefinition field,
Stack<String> elementStack,
ConstraintDataProvider dataProvider,
ObjectStructureDefinition objStructure,
Object rootData,
ObjectStructureDefinition rootObjStructure,
Object value,
ContextInfo contextInfo)
processBaseConstraints
protected void processBaseConstraints(List<ValidationResultInfo> valResults,
Constraint constraint,
FieldDefinition field,
Object value,
Stack<String> elementStack,
ContextInfo contextInfo)
processCrossFieldWarning
protected void processCrossFieldWarning(List<ValidationResultInfo> valResults,
CaseConstraint crossConstraint,
Constraint constraint,
Object value,
ValidationResult.ErrorLevel errorLevel,
ContextInfo contextInfo)
- This adds a warning on the related field when a processed case-constraint results in a warning
- Parameters:
valResults
- crossConstraint
- field
-
processCrossFieldWarning
protected void processCrossFieldWarning(List<ValidationResultInfo> valResults,
RequiredConstraint requiredConstraint,
ValidationResult.ErrorLevel errorLevel,
String field,
ContextInfo contextInfo)
- This adds a warning on the related field when a processed case-constraint results in a warning
- Parameters:
valResults
- requiredConstraint
- field
-
processCrossFieldWarning
protected void processCrossFieldWarning(List<ValidationResultInfo> valResults,
LookupConstraint lookupConstraint,
ValidationResult.ErrorLevel errorLevel,
ContextInfo contextInfo)
- This adds a warning on the related field when a processed lookup-constraint results in a warning
- Parameters:
valResults
- lookupConstraint
-
addCrossFieldWarning
protected void addCrossFieldWarning(List<ValidationResultInfo> valResults,
String crossFieldPath,
String message,
ValidationResult.ErrorLevel errorLevel)
validateBoolean
protected void validateBoolean(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
validateDouble
protected void validateDouble(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
validateFloat
protected void validateFloat(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
validateLong
protected void validateLong(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
validateInteger
protected void validateInteger(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
validateDate
protected void validateDate(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
DateParser dateParser,
ContextInfo contextInfo)
validateString
protected void validateString(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
ContextInfo contextInfo)
getMessage
protected String getMessage(String messageId,
ContextInfo contextInfo)
getElementXpath
protected String getElementXpath(Stack<String> elementStack)
hasText
protected boolean hasText(String string)
toMap
protected Map<String,Object> toMap(Constraint c)
getSearchDispatcher
public SearchDispatcher getSearchDispatcher()
setSearchDispatcher
public void setSearchDispatcher(SearchDispatcher searchDispatcher)
validateObject
public List<ValidationResultInfo> validateObject(FieldDefinition field,
Object o,
ObjectStructureDefinition objStructure,
Stack<String> elementStack,
ContextInfo contextInfo)
- Specified by:
validateObject
in interface Validator
- Specified by:
validateObject
in class BaseAbstractValidator
- See Also:
org.kuali.student.r1.common.validator.Validator#validateObject(org.kuali.student.common.dictionary.dto.FieldDefinition, java.lang.Object, org.kuali.student.common.dictionary.dto.ObjectStructureDefinition, java.util.Stack)
Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.