|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl
public class DictionaryValidationServiceImpl
Validates Documents, Business Objects, and Attributes against the data dictionary. Including min, max lengths, and validating expressions. This is the default, Kuali delivered implementation. KULRICE - 3355 Modified to prevent infinite looping (to maxDepth) scenario when a parent references a child which references a parent
Field Summary | |
---|---|
protected BusinessObjectService |
businessObjectService
|
protected DataDictionaryService |
dataDictionaryService
|
protected DocumentDictionaryService |
documentDictionaryService
|
protected PersistenceService |
persistenceService
|
protected PersistenceStructureService |
persistenceStructureService
|
static String |
VALIDATE_METHOD
Constant defines a validation method for an attribute value. |
protected WorkflowAttributePropertyResolutionService |
workflowAttributePropertyResolutionService
|
Constructor Summary | |
---|---|
DictionaryValidationServiceImpl()
|
Method Summary | |
---|---|
List<CollectionConstraintProcessor> |
getCollectionConstraintProcessors()
|
List<ConstraintProvider> |
getConstraintProviders()
|
DataDictionaryService |
getDataDictionaryService()
|
DocumentDictionaryService |
getDocumentDictionaryService()
|
List<ConstraintProcessor> |
getElementConstraintProcessors()
|
protected WorkflowAttributePropertyResolutionService |
getWorkflowAttributePropertyResolutionService()
|
boolean |
isBusinessObjectValid(BusinessObject businessObject)
Encapsulates {@link #validateBusinessObject(BusinessObject) and returns boolean so one doesn't need to
check the
ErrorMap.Validates the business object primitive attributes against the data dictionary. |
boolean |
isBusinessObjectValid(BusinessObject businessObject,
String prefix)
Encapsulates {@link #validateBusinessObject(BusinessObject) and returns boolean so one doesn't need to
check the
ErrorMap.Validates the business object primitive attributes against the data dictionary. |
protected Set<BusinessObject> |
newIdentitySet()
creates a new IdentitySet. |
void |
setBusinessObjectService(BusinessObjectService businessObjectService)
Sets the businessObjectService attribute value. |
void |
setCollectionConstraintProcessors(List<CollectionConstraintProcessor> collectionConstraintProcessors)
|
void |
setConstraintProviders(List<ConstraintProvider> constraintProviders)
|
void |
setDataDictionaryService(DataDictionaryService dataDictionaryService)
|
void |
setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
|
void |
setElementConstraintProcessors(List<ConstraintProcessor> elementConstraintProcessors)
|
void |
setPersistenceService(PersistenceService persistenceService)
Sets the persistenceService attribute value. |
void |
setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
|
DictionaryValidationResult |
validate(AttributeValueReader valueReader,
boolean doOptionalProcessing)
Same as other validate method except, allows you to provide the attributeValueReader directly for evaluation |
DictionaryValidationResult |
validate(Object object)
Validates an object using its class name as the entry name to look up its metadata in the dictionary. |
DictionaryValidationResult |
validate(Object object,
boolean doOptionalProcessing)
Validates an object using its class name as the entry name to look up its metadata in the dictionary. |
DictionaryValidationResult |
validate(Object object,
String entryName)
Validates an object using the passed entry name to look up metadata in the dictionary |
DictionaryValidationResult |
validate(Object object,
String entryName,
boolean doOptionalProcessing)
Same as DictionaryValidationService.validate(java.lang.Object, java.lang.String) except that it provides a boolean parameter for
the
calling method to choose whether to do optional processing (generally to check if blank/empty values are
required
or not). |
DictionaryValidationResult |
validate(Object object,
String entryName,
DataDictionaryEntry entry,
boolean doOptionalProcessing)
Same as {@link DictionaryValidationService#validate(Object, String, boolean) except that it provides an explicit data dictionary entry to use for the purpose of validation. |
DictionaryValidationResult |
validate(Object object,
String entryName,
String attributeName)
Validates a single attribute on the passed object using the passed entry name to look up metadata in the dictionary. |
DictionaryValidationResult |
validate(Object object,
String entryName,
String attributeName,
boolean doOptionalProcessing)
Same as DictionaryValidationService.validate(Object, String, String) except that it provides a boolean parameter for the
calling method to choose whether to do optional processing (generally to check if blank/empty values are
required
or not). |
void |
validate(String entryName,
String attributeName,
Object attributeValue)
Instead of validating an object with dictionary metadata, or validating a specific member of an object by name, validates a specific attribute of an object by passing in the attribute value itself. |
void |
validate(String entryName,
String attributeName,
Object attributeValue,
boolean doOptionalProcessing)
Same as DictionaryValidationService.validate(String, String, Object) except that it provides a boolean parameter for the
calling method to choose whether to do optional processing (generally to check if blank/empty values are
required
or not). |
void |
validateBusinessObject(BusinessObject businessObject)
Validates the business object primitive attributes against the data dictionary. |
void |
validateBusinessObject(BusinessObject businessObject,
boolean validateRequired)
Validates the business object primitive attributes against the data dictionary. |
protected void |
validateBusinessObjectsFromDescriptors(Object object,
PropertyDescriptor[] propertyDescriptors,
int depth)
iterates through the property descriptors looking for business objects or lists of business objects. |
void |
validateBusinessObjectsRecursively(BusinessObject businessObject,
int depth)
|
boolean |
validateDefaultExistenceChecks(BusinessObject bo)
This method does an existence check against all references of a BusinessObject as defined in the MaintenanceDocument.xml file for that business object. |
boolean |
validateDefaultExistenceChecksForNewCollectionItem(BusinessObject bo,
BusinessObject newCollectionItem,
String collectionName)
Does an existence check against all references configured as a default existence check in the maintenance document data dictionary file for the given business object Appropriate errors will also be placed in the GlobalVariables.ErrorMap. |
boolean |
validateDefaultExistenceChecksForNewCollectionItem(TransactionalDocument document,
BusinessObject newCollectionItem,
String collectionName)
This method does an existence check against all references of a transactionalDocument Appropriate errors will also be placed in the GlobalVariables.ErrorMap. |
boolean |
validateDefaultExistenceChecksForTransDoc(TransactionalDocument document)
This method does an existence check against all references of a transactionalDocument Appropriate errors will also be placed in the GlobalVariables.ErrorMap. |
void |
validateDocument(Document document)
Validates the contents of a document (i.e. |
void |
validateDocumentAndUpdatableReferencesRecursively(Document document,
int maxDepth,
boolean validateRequired)
Validates the contents of a document and recursively validates any of its updatable references |
void |
validateDocumentAndUpdatableReferencesRecursively(Document document,
int maxDepth,
boolean validateRequired,
boolean chompLastLetterSFromCollectionName)
Validates the contents of a document and recursively validates any of its updatable references |
void |
validateDocumentAttribute(Document document,
String attributeName,
String errorPrefix)
Validates the specified attribute of the given document against the data dictionary. |
void |
validatePrimitiveFromDescriptor(String entryName,
Object object,
PropertyDescriptor propertyDescriptor,
String errorPrefix,
boolean validateRequired)
Deprecated. since 1.1 |
boolean |
validateReferenceExists(BusinessObject bo,
ReferenceDefinition reference)
This method examines the populated BusinessObject bo instance passed in for a member named by the referenceName. |
boolean |
validateReferenceExists(BusinessObject bo,
String referenceName)
This method examines the populated BusinessObject bo instance passed in for a member named by the referenceName. |
boolean |
validateReferenceExistsAndIsActive(BusinessObject bo,
ReferenceDefinition reference)
This method intelligently tests the designated reference on the bo for both existence and active status, where appropriate. |
boolean |
validateReferenceExistsAndIsActive(BusinessObject bo,
String referenceName,
String attributeToHighlightOnFail,
String displayFieldName)
This method intelligently tests the designated reference on the bo for both existence and active status, where appropriate. |
boolean |
validateReferenceIsActive(BusinessObject bo,
ReferenceDefinition reference)
This method retrieves the reference from the DB, and then tests whether the object is active. |
boolean |
validateReferenceIsActive(BusinessObject bo,
String referenceName)
This method retrieves the reference from the DB, and then tests whether the object is active. |
protected void |
validateUpdatabableReferencesRecursively(BusinessObject businessObject,
int maxDepth,
boolean validateRequired,
boolean chompLastLetterSFromCollectionName,
Set<BusinessObject> processedBOs)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VALIDATE_METHOD
Value is "validate"
protected DataDictionaryService dataDictionaryService
protected BusinessObjectService businessObjectService
protected PersistenceService persistenceService
protected DocumentDictionaryService documentDictionaryService
protected WorkflowAttributePropertyResolutionService workflowAttributePropertyResolutionService
protected PersistenceStructureService persistenceStructureService
Constructor Detail |
---|
public DictionaryValidationServiceImpl()
Method Detail |
---|
protected final Set<BusinessObject> newIdentitySet()
public DictionaryValidationResult validate(Object object)
DictionaryValidationService
validate
in interface DictionaryValidationService
object
- - an object to validate
DictionaryValidationService.validate(java.lang.Object)
public DictionaryValidationResult validate(Object object, boolean doOptionalProcessing)
DictionaryValidationService
validate
in interface DictionaryValidationService
object
- - an object to validatedoOptionalProcessing
- true if the validation should do optional validation (e.g. to check if empty values
are required or not), false otherwise
DictionaryValidationService.validate(java.lang.Object, boolean)
public DictionaryValidationResult validate(Object object, String entryName)
DictionaryValidationService
validate
in interface DictionaryValidationService
object
- - an object to validateentryName
- - the dictionary entry name to look up the metadata associated with this object
DictionaryValidationService.validate(java.lang.Object, java.lang.String)
public DictionaryValidationResult validate(Object object, String entryName, boolean doOptionalProcessing)
DictionaryValidationService
DictionaryValidationService.validate(java.lang.Object, java.lang.String)
except that it provides a boolean parameter for
the
calling method to choose whether to do optional processing (generally to check if blank/empty values are
required
or not).
validate
in interface DictionaryValidationService
object
- - an object to validateentryName
- - the dictionary entry name to look up the metadata associated with this objectdoOptionalProcessing
- true if the validation should do optional validation (e.g. to check if empty values
are required or not), false otherwise
DictionaryValidationService.validate(java.lang.Object, java.lang.String,
boolean)
public DictionaryValidationResult validate(Object object, String entryName, String attributeName)
DictionaryValidationService
validate
in interface DictionaryValidationService
object
- - an object to validateentryName
- - the dictionary entry name to look up the metadata associated with this objectattributeName
- - the name of the attribute (field) on the object that should be validated
DictionaryValidationService.validate(java.lang.Object, java.lang.String,
java.lang.String)
public DictionaryValidationResult validate(Object object, String entryName, String attributeName, boolean doOptionalProcessing)
DictionaryValidationService
DictionaryValidationService.validate(Object, String, String)
except that it provides a boolean parameter for the
calling method to choose whether to do optional processing (generally to check if blank/empty values are
required
or not).
validate
in interface DictionaryValidationService
object
- - an object to validateentryName
- - the dictionary entry name to look up the metadata associated with this objectattributeName
- - the name of the attribute (field) on the object that should be validateddoOptionalProcessing
- true if the validation should do optional validation (e.g. to check if empty values
are required or not), false otherwise
DictionaryValidationService.validate(java.lang.Object, java.lang.String,
java.lang.String, boolean)
public DictionaryValidationResult validate(Object object, String entryName, DataDictionaryEntry entry, boolean doOptionalProcessing)
DictionaryValidationService
validate
in interface DictionaryValidationService
object
- - an object to validateentryName
- - the dictionary entry name to use in association with error look upsentry
- - the dictionary entry to use for validationdoOptionalProcessing
- true if the validation should do optional validation (e.g. to check if empty values
are required or not), false otherwise
public void validate(String entryName, String attributeName, Object attributeValue)
DictionaryValidationService
validate
in interface DictionaryValidationService
entryName
- - the dictionary entry name to use in association with error look upsattributeName
- - the dictionary entry attribute name to use in association with error look upsattributeValue
- - the value of the attribute being validatedpublic void validate(String entryName, String attributeName, Object attributeValue, boolean doOptionalProcessing)
DictionaryValidationService
DictionaryValidationService.validate(String, String, Object)
except that it provides a boolean parameter for the
calling method to choose whether to do optional processing (generally to check if blank/empty values are
required
or not).
validate
in interface DictionaryValidationService
entryName
- - the dictionary entry name to use in association with error look upsattributeName
- - the dictionary entry attribute name to use in association with error look upsattributeValue
- - the value of the attribute being validateddoOptionalProcessing
- - true if the validation should do optional validation (e.g. to check if empty
values
are required or not), false otherwisepublic void validateDocument(Document document)
DictionaryValidationService
validateDocument
in interface DictionaryValidationService
document
- - document to validateDictionaryValidationService.validateDocument(org.kuali.rice.krad.document.Document)
public void validateDocumentAttribute(Document document, String attributeName, String errorPrefix)
DictionaryValidationService
validateDocumentAttribute
in interface DictionaryValidationService
DictionaryValidationService.validateDocumentAttribute(org.kuali.rice.krad.document.Document,
java.lang.String, java.lang.String)
public void validateDocumentAndUpdatableReferencesRecursively(Document document, int maxDepth, boolean validateRequired)
DictionaryValidationService
validateDocumentAndUpdatableReferencesRecursively
in interface DictionaryValidationService
document
- the documentmaxDepth
- the maximum numbers of levels to recursevalidateRequired
- whether to validate whether a field is required and is currently blankDictionaryValidationService.validateDocumentAndUpdatableReferencesRecursively(org.kuali.rice.krad.document.Document, int, boolean)
public void validateDocumentAndUpdatableReferencesRecursively(Document document, int maxDepth, boolean validateRequired, boolean chompLastLetterSFromCollectionName)
DictionaryValidationService
validateDocumentAndUpdatableReferencesRecursively
in interface DictionaryValidationService
document
- the documentmaxDepth
- the maximum numbers of levels to recursevalidateRequired
- whether to validate whether a field is required and is currently blankchompLastLetterSFromCollectionName
- if true, the error path for any collections encountered will have the
last "s" removed from the collection name if it ends
with the letter "s". If false, this method acts like DictionaryValidationService.validateDocumentAndUpdatableReferencesRecursively(Document,
int, boolean)
DictionaryValidationService.validateDocumentAndUpdatableReferencesRecursively(org.kuali.rice.krad.document.Document, int, boolean, boolean)
protected void validateUpdatabableReferencesRecursively(BusinessObject businessObject, int maxDepth, boolean validateRequired, boolean chompLastLetterSFromCollectionName, Set<BusinessObject> processedBOs)
public boolean isBusinessObjectValid(BusinessObject businessObject)
DictionaryValidationService
{@link #validateBusinessObject(BusinessObject) and returns boolean so one doesn't need to
check the
ErrorMap.Validates the business object primitive attributes against the data dictionary. Adds errors to the map
as they are
encountered.
Makes no error path adjustments
- Specified by:
isBusinessObjectValid
in interface DictionaryValidationService
- Parameters:
businessObject
- - business object to validate
- Returns:
- boolean validOrNot
- See Also:
DictionaryValidationService.isBusinessObjectValid(org.kuali.rice.krad.bo.BusinessObject)
public boolean isBusinessObjectValid(BusinessObject businessObject, String prefix)
DictionaryValidationService
{@link #validateBusinessObject(BusinessObject) and returns boolean so one doesn't need to
check the
ErrorMap.Validates the business object primitive attributes against the data dictionary. Adds errors to the map
as they are
encountered.
Makes no error path adjustments
- Specified by:
isBusinessObjectValid
in interface DictionaryValidationService
- Parameters:
businessObject
- - business object to validateprefix
- - error prefix
- Returns:
- boolean valid or not
- See Also:
DictionaryValidationService.isBusinessObjectValid(org.kuali.rice.krad.bo.BusinessObject,
String)
public void validateBusinessObjectsRecursively(BusinessObject businessObject, int depth)
businessObject
- - business object to validatepublic void validateBusinessObject(BusinessObject businessObject)
DictionaryValidationService
validateBusinessObject
in interface DictionaryValidationService
businessObject
- - business object to validateDictionaryValidationService.validateBusinessObject(org.kuali.rice.krad.bo.BusinessObject)
public void validateBusinessObject(BusinessObject businessObject, boolean validateRequired)
DictionaryValidationService
validateBusinessObject
in interface DictionaryValidationService
businessObject
- - business object to validatevalidateRequired
- - whether to execute required field checksDictionaryValidationService.validateBusinessObject(org.kuali.rice.krad.bo.BusinessObject,
boolean)
protected void validateBusinessObjectsFromDescriptors(Object object, PropertyDescriptor[] propertyDescriptors, int depth)
object
- propertyDescriptors
- @Deprecated public void validatePrimitiveFromDescriptor(String entryName, Object object, PropertyDescriptor propertyDescriptor, String errorPrefix, boolean validateRequired)
validatePrimitiveFromDescriptor
in interface DictionaryValidationService
entryName
- object
- propertyDescriptor
- errorPrefix
- public boolean validateReferenceExists(BusinessObject bo, ReferenceDefinition reference)
DictionaryValidationService
validateReferenceExists
in interface DictionaryValidationService
bo
- - The bo whose reference is being tested.reference
- - The ReferenceDefinition to be existence tested.
DictionaryValidationService.validateReferenceExists(org.kuali.rice.krad.bo.BusinessObject,
org.kuali.rice.krad.datadictionary.ReferenceDefinition)
public boolean validateReferenceExists(BusinessObject bo, String referenceName)
DictionaryValidationService
validateReferenceExists
in interface DictionaryValidationService
bo
- - The bo whose reference is being tested.referenceName
- - The name of the member to be existence tested.
DictionaryValidationService.validateReferenceExists(org.kuali.rice.krad.bo.BusinessObject,
java.lang.String)
public boolean validateReferenceIsActive(BusinessObject bo, ReferenceDefinition reference)
DictionaryValidationService
validateReferenceIsActive
in interface DictionaryValidationService
DictionaryValidationService.validateReferenceIsActive(org.kuali.rice.krad.bo.BusinessObject,
org.kuali.rice.krad.datadictionary.ReferenceDefinition)
public boolean validateReferenceIsActive(BusinessObject bo, String referenceName)
DictionaryValidationService
validateReferenceIsActive
in interface DictionaryValidationService
DictionaryValidationService.validateReferenceIsActive(org.kuali.rice.krad.bo.BusinessObject, String)
public boolean validateReferenceExistsAndIsActive(BusinessObject bo, ReferenceDefinition reference)
DictionaryValidationService
validateReferenceExistsAndIsActive
in interface DictionaryValidationService
bo
- - the BusinessObject instance to be tested.reference
- - the ReferenceDefinition to control the nature of the testing.
DictionaryValidationService.validateReferenceExistsAndIsActive(org.kuali.rice.krad.bo.BusinessObject,
org.kuali.rice.krad.datadictionary.ReferenceDefinition)
public boolean validateReferenceExistsAndIsActive(BusinessObject bo, String referenceName, String attributeToHighlightOnFail, String displayFieldName)
DictionaryValidationService
validateReferenceExistsAndIsActive
in interface DictionaryValidationService
bo
- - the BusinessObject instance to be tested.referenceName
- - the member name on the bo to be tested for existence and active-stateattributeToHighlightOnFail
- - the fieldName to highlight with the error message on a failuredisplayFieldName
- - the human-readable display name of the failed field, to go in the error message
DictionaryValidationService.validateReferenceExistsAndIsActive(org.kuali.rice.krad.bo.BusinessObject, String, String, String)
public boolean validateDefaultExistenceChecks(BusinessObject bo)
DictionaryValidationService
validateDefaultExistenceChecks
in interface DictionaryValidationService
bo
- - BusinessObject instance that should be tested
DictionaryValidationService.validateDefaultExistenceChecks(org.kuali.rice.krad.bo.BusinessObject)
public boolean validateDefaultExistenceChecksForNewCollectionItem(BusinessObject bo, BusinessObject newCollectionItem, String collectionName)
DictionaryValidationService
validateDefaultExistenceChecksForNewCollectionItem
in interface DictionaryValidationService
bo
- parent business object instance to retrieve default checks fornewCollectionItem
- new collection line to validatecollectionName
- name of the collection in the parent
DictionaryValidationService.validateDefaultExistenceChecksForNewCollectionItem(org.kuali.rice.krad.bo.BusinessObject,
org.kuali.rice.krad.bo.BusinessObject, java.lang.String)
public boolean validateDefaultExistenceChecksForTransDoc(TransactionalDocument document)
DictionaryValidationService
validateDefaultExistenceChecksForTransDoc
in interface DictionaryValidationService
document
- document instance that should be tested
DictionaryValidationService.validateDefaultExistenceChecksForTransDoc(org.kuali.rice.krad.document.TransactionalDocument)
public boolean validateDefaultExistenceChecksForNewCollectionItem(TransactionalDocument document, BusinessObject newCollectionItem, String collectionName)
DictionaryValidationService
validateDefaultExistenceChecksForNewCollectionItem
in interface DictionaryValidationService
document
- document instance that should be testednewCollectionItem
- that should be testedcollectionName
- that should be tested
DictionaryValidationService.validateDefaultExistenceChecksForNewCollectionItem(org.kuali.rice.krad.document.TransactionalDocument, org.kuali.rice.krad.bo.BusinessObject, String)
public DictionaryValidationResult validate(AttributeValueReader valueReader, boolean doOptionalProcessing)
DictionaryValidationService
validate
in interface DictionaryValidationService
valueReader
- - an object to validatedoOptionalProcessing
- true if the validation should do optional validation (e.g. to check if empty values
are required or not), false otherwise
public DataDictionaryService getDataDictionaryService()
public void setDataDictionaryService(DataDictionaryService dataDictionaryService)
dataDictionaryService
- The dataDictionaryService to set.public void setBusinessObjectService(BusinessObjectService businessObjectService)
businessObjectService
- The businessObjectService to set.public void setPersistenceService(PersistenceService persistenceService)
persistenceService
- The persistenceService to set.public void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
protected WorkflowAttributePropertyResolutionService getWorkflowAttributePropertyResolutionService()
public List<CollectionConstraintProcessor> getCollectionConstraintProcessors()
public void setCollectionConstraintProcessors(List<CollectionConstraintProcessor> collectionConstraintProcessors)
collectionConstraintProcessors
- the collectionConstraintProcessors to setpublic List<ConstraintProvider> getConstraintProviders()
public void setConstraintProviders(List<ConstraintProvider> constraintProviders)
constraintProviders
- the constraintProviders to setpublic List<ConstraintProcessor> getElementConstraintProcessors()
public void setElementConstraintProcessors(List<ConstraintProcessor> elementConstraintProcessors)
elementConstraintProcessors
- the elementConstraintProcessors to setpublic DocumentDictionaryService getDocumentDictionaryService()
public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |