org.kuali.student.common.validator
Class DefaultValidatorImpl
java.lang.Object
org.kuali.student.common.validator.BaseAbstractValidator
org.kuali.student.common.validator.DefaultValidatorImpl
- All Implemented Interfaces:
- Validator
- Direct Known Subclasses:
- ActiveDatesValidator, ExpenditurePercentValidator, RevenuePercentValidator, SubjectAreaUnitOwnerValidator
public class DefaultValidatorImpl
- extends BaseAbstractValidator
Method Summary |
protected void |
addCrossFieldWarning(List<ValidationResultInfo> valResults,
String crossFieldPath,
String message)
|
DateParser |
getDateParser()
|
protected String |
getElementXpath(Stack<String> elementStack)
|
protected String |
getMessage(String messageId)
|
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)
|
protected Constraint |
processCaseConstraint(List<ValidationResultInfo> valResults,
FieldDefinition field,
ObjectStructureDefinition objStructure,
Object value,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure)
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)
|
protected void |
processCrossFieldWarning(List<ValidationResultInfo> valResults,
CaseConstraint crossConstraint,
ValidationResultInfo.ErrorLevel errorLevel)
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,
ValidationResultInfo.ErrorLevel errorLevel)
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,
ValidationResultInfo.ErrorLevel errorLevel,
String field)
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)
|
protected void |
processNestedObjectStructure(List<ValidationResultInfo> results,
Object value,
ObjectStructureDefinition nestedObjStruct,
FieldDefinition field,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure)
|
protected ValidationResultInfo |
processOccursConstraint(String element,
MustOccurConstraint constraint,
FieldDefinition field,
ObjectStructureDefinition objStructure,
ConstraintDataProvider dataProvider)
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)
|
ValidationResultInfo |
processValidCharConstraint(String element,
ValidCharsConstraint vcConstraint,
ConstraintDataProvider dataProvider,
Object value)
|
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)
|
protected void |
validateDate(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
DateParser dateParser)
|
protected void |
validateDouble(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
|
void |
validateField(List<ValidationResultInfo> results,
FieldDefinition field,
ObjectStructureDefinition objStruct,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjectStructure)
|
protected void |
validateFloat(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
|
protected void |
validateInteger(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
|
protected void |
validateLong(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
|
List<ValidationResultInfo> |
validateObject(FieldDefinition field,
Object o,
ObjectStructureDefinition objStructure,
Stack<String> elementStack)
|
private void |
validateObject(List<ValidationResultInfo> results,
Object data,
ObjectStructureDefinition objStructure,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure,
boolean isRoot)
|
List<ValidationResultInfo> |
validateObject(Object data,
ObjectStructureDefinition objStructure)
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
static final Logger LOG
messageService
private MessageService messageService
searchDispatcher
private SearchDispatcher searchDispatcher
messageLocaleKey
private String messageLocaleKey
messageGroupKey
private String messageGroupKey
dateParser
private DateParser dateParser
serverSide
private boolean serverSide
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)
- 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:
Validator.validateObject(java.lang.Object, org.kuali.student.common.dictionary.dto.ObjectStructureDefinition)
validateObject
private void validateObject(List<ValidationResultInfo> results,
Object data,
ObjectStructureDefinition objStructure,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure,
boolean isRoot)
validateField
public void validateField(List<ValidationResultInfo> results,
FieldDefinition field,
ObjectStructureDefinition objStruct,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjectStructure)
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)
processConstraint
protected void processConstraint(List<ValidationResultInfo> valResults,
FieldDefinition field,
ObjectStructureDefinition objStructure,
Object value,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure)
processRequireConstraint
protected ValidationResultInfo processRequireConstraint(String element,
RequiredConstraint constraint,
FieldDefinition field,
ObjectStructureDefinition objStructure,
ConstraintDataProvider dataProvider)
processCaseConstraint
protected Constraint processCaseConstraint(List<ValidationResultInfo> valResults,
FieldDefinition field,
ObjectStructureDefinition objStructure,
Object value,
ConstraintDataProvider dataProvider,
Stack<String> elementStack,
Object rootData,
ObjectStructureDefinition rootObjStructure)
- Process caseConstraint tag and sets any of the base constraint items if any of the when condition matches
- Parameters:
constraint
- caseConstraint
- field
-
processValidCharConstraint
public ValidationResultInfo processValidCharConstraint(String element,
ValidCharsConstraint vcConstraint,
ConstraintDataProvider dataProvider,
Object value)
processOccursConstraint
protected ValidationResultInfo processOccursConstraint(String element,
MustOccurConstraint constraint,
FieldDefinition field,
ObjectStructureDefinition objStructure,
ConstraintDataProvider dataProvider)
- 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)
processBaseConstraints
protected void processBaseConstraints(List<ValidationResultInfo> valResults,
Constraint constraint,
FieldDefinition field,
Object value,
Stack<String> elementStack)
processCrossFieldWarning
protected void processCrossFieldWarning(List<ValidationResultInfo> valResults,
CaseConstraint crossConstraint,
ValidationResultInfo.ErrorLevel errorLevel)
- 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,
ValidationResultInfo.ErrorLevel errorLevel,
String field)
- 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,
ValidationResultInfo.ErrorLevel errorLevel)
- 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)
validateBoolean
protected void validateBoolean(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
validateDouble
protected void validateDouble(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
validateFloat
protected void validateFloat(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
validateLong
protected void validateLong(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
validateInteger
protected void validateInteger(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
validateDate
protected void validateDate(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results,
DateParser dateParser)
validateString
protected void validateString(Object value,
Constraint constraint,
String element,
List<ValidationResultInfo> results)
getMessage
protected String getMessage(String messageId)
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)
- Specified by:
validateObject
in interface Validator
- Specified by:
validateObject
in class BaseAbstractValidator
- See Also:
Validator.validateObject(org.kuali.student.common.dictionary.dto.FieldDefinition, java.lang.Object, org.kuali.student.common.dictionary.dto.ObjectStructureDefinition, java.util.Stack)
Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.