Interface DictionaryValidationService
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptionbooleanisBusinessObjectValid(Object businessObject) EncapsulatesvalidateBusinessObject(BusinessObject)and returns boolean so one doesn't need to check the ErrorMap.Validates the business object primitive attributes against the data dictionary.booleanisBusinessObjectValid(Object businessObject, String prefix) EncapsulatesvalidateBusinessObject(BusinessObject)and returns boolean so one doesn't need to check the ErrorMap.Validates the business object primitive attributes against the data dictionary.Validates an object using its class name as the entry name to look up its metadata in the dictionary.Validate an object with the passed in dictionary entryName and the specific attribute to be evaluatedvalidate(Object object, String entryName, DataDictionaryEntry entry, boolean doOptionalProcessing) Same asvalidate(Object, String, String, boolean)except that it provides an explicit data dictionary entry to use for the purpose of validation.validate(AttributeValueReader valueReader, boolean doOptionalProcessing, String validationState, StateMapping stateMapping) Same as other validate methods, except allows you to provide the attributeValueReader directly for evaluationvalidateAgainstNextState(Object object) Validates the object agains the next state (or current state if there is no next state).validateAgainstState(Object object, String validationState) Validates the object against the state specified.voidvalidateBusinessObject(Object businessObject) Deprecated.since 1.1 - use validate(Object.class) insteadvoidvalidateBusinessObject(Object businessObject, boolean validateRequired) Deprecated.since 1.1 - use validate(Object.class) insteadbooleanvalidateDefaultExistenceChecks(Object dataObject) This method does an existence check against all references of a BusinessObject as defined in the MaintenanceDocument.xml file for that business object.booleanvalidateDefaultExistenceChecksForNewCollectionItem(Object dataObject, Object 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.booleanvalidateDefaultExistenceChecksForNewCollectionItem(TransactionalDocument document, Object 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.booleanThis method does an existence check against all references of a transactionalDocument Appropriate errors will also be placed in the GlobalVariables.ErrorMap.voidvalidateDocument(Document document) Validates the contents of a document (i.e. attributes within a document) against the data dictionary.voidvalidateDocumentAndUpdatableReferencesRecursively(Document document, int maxDepth, boolean validateRequired) Validates the contents of a document and recursively validates any of its updatable referencesvoidvalidateDocumentAndUpdatableReferencesRecursively(Document document, int maxDepth, boolean validateRequired, boolean chompLastLetterSFromCollectionName) Validates the contents of a document and recursively validates any of its updatable referencesvoidvalidateDocumentAttribute(Document document, String attributeName, String errorPrefix) Validates the specified attribute of the given document against the data dictionary.voidvalidatePrimitiveFromDescriptor(String entryName, Object object, PropertyDescriptor propertyDescriptor, String errorPrefix, boolean validateRequired) Deprecated.since 1.1booleanvalidateReferenceExists(Object dataObject, String referenceName) This method examines the populated BusinessObject bo instance passed in for a member named by the referenceName.booleanvalidateReferenceExists(Object dataObject, ReferenceDefinition reference) This method examines the populated BusinessObject bo instance passed in for a member named by the referenceName.booleanvalidateReferenceExistsAndIsActive(Object dataObject, String referenceName, String attributeToHighlightOnFail, String displayFieldName) This method intelligently tests the designated reference on the data object for both existence and active status, where appropriate.booleanvalidateReferenceExistsAndIsActive(Object dataObject, ReferenceDefinition reference) validateReferenceExistsAndIsActive intelligently tests the designated reference on the data object for both existence and active status, where appropriatebooleanvalidateReferenceIsActive(Object dataObject, String referenceName) This method retrieves the reference from the DB, and then tests whether the object is active.booleanvalidateReferenceIsActive(Object dataObject, ReferenceDefinition reference) This method retrieves the reference from the DB, and then tests whether the object is active.
-
Method Details
-
validateDocument
Validates the contents of a document (i.e. attributes within a document) against the data dictionary.- Parameters:
document- - document to validate
-
validateDocumentAndUpdatableReferencesRecursively
void validateDocumentAndUpdatableReferencesRecursively(Document document, int maxDepth, boolean validateRequired) Validates the contents of a document and recursively validates any of its updatable references- Parameters:
document- the documentmaxDepth- the maximum numbers of levels to recursevalidateRequired- whether to validate whether a field is required and is currently blank
-
validateDocumentAndUpdatableReferencesRecursively
void validateDocumentAndUpdatableReferencesRecursively(Document document, int maxDepth, boolean validateRequired, boolean chompLastLetterSFromCollectionName) Validates the contents of a document and recursively validates any of its updatable references- Parameters:
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 likevalidateDocumentAndUpdatableReferencesRecursively(Document, int, boolean)
-
validateDocumentAttribute
Validates the specified attribute of the given document against the data dictionary.- Parameters:
document-attributeName-errorPrefix-
-
validate
Validates an object using its class name as the entry name to look up its metadata in the dictionary.- Parameters:
object- - an object to validate- Returns:
- the dictionary validation result object associated with this validation
-
validate
DictionaryValidationResult validate(Object object, String entryName, String attributeName, boolean doOptionalProcessing) Validate an object with the passed in dictionary entryName and the specific attribute to be evaluated- Parameters:
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- Returns:
- the dictionary validation result object associated with this validation
- Since:
- 1.1
-
validate
DictionaryValidationResult validate(Object object, String entryName, DataDictionaryEntry entry, boolean doOptionalProcessing) Same asvalidate(Object, String, String, boolean)except that it provides an explicit data dictionary entry to use for the purpose of validation.- Parameters:
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- Returns:
- the dictionary validation result object associated with this validation
- Since:
- 1.1
-
validateAgainstNextState
Validates the object agains the next state (or current state if there is no next state).When no stateMapping exists on the DataDictionaryEntry that applies for this object, validation is considered stateless and all constraints are processed regardless of their states attribute.
- Parameters:
object-- Returns:
- the dictionary validation result object associated with this validation
- Since:
- 2.2
-
validateAgainstState
Validates the object against the state specified.Important note: Alternatively the state can be changed on the object itself and another validation method can be used instead of this one (in practice, you'd revert the state on the object if validation returns errors).
- Parameters:
object-validationState-- Returns:
- the dictionary validation result object associated with this validation
- Since:
- 2.2
-
validate
DictionaryValidationResult validate(AttributeValueReader valueReader, boolean doOptionalProcessing, String validationState, StateMapping stateMapping) Same as other validate methods, except allows you to provide the attributeValueReader directly for evaluation- Parameters:
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- Returns:
- the dictionary validation result object associated with this validation
- Since:
- 1.1
-
isBusinessObjectValid
EncapsulatesvalidateBusinessObject(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- Parameters:
businessObject- - business object to validate- Returns:
- boolean validOrNot
-
isBusinessObjectValid
EncapsulatesvalidateBusinessObject(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- Parameters:
businessObject- - business object to validateprefix- - error prefix- Returns:
- boolean valid or not
-
validateBusinessObject
Deprecated.since 1.1 - use validate(Object.class) insteadValidates the business object primitive attributes against the data dictionary. Adds errors to the map as they are encountered.- Parameters:
businessObject- - business object to validate
-
validateBusinessObject
Deprecated.since 1.1 - use validate(Object.class) insteadValidates the business object primitive attributes against the data dictionary. Adds errors to the map as they are encountered.- Parameters:
businessObject- - business object to validatevalidateRequired- - whether to execute required field checks
-
validateReferenceExists
This method examines the populated BusinessObject bo instance passed in for a member named by the referenceName. If this member exists, and if this member is a descendent of BusinessObject, then an existence check proceeds. First the foreign keys for this reference are gathered, and then examined to see if they have values. If they do not have values, the method ends with a true return value. If they all have values, then an object with those primary keys is retrieve from the database. If one is retrieve, then the reference exists, and True is returned. Otherwise, false is returned. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
dataObject- - the data object whose reference is being tested.reference- - The ReferenceDefinition to be existence tested.- Returns:
- True if no exceptions occur and the object exists in the db, false otherwise.
-
validateReferenceExists
This method examines the populated BusinessObject bo instance passed in for a member named by the referenceName. If this member exists, and if this member is a descendent of BusinessObject, then an existence check proceeds. First the foreign keys for this reference are gathered, and then examined to see if they have values. If they do not have values, the method ends with a true return value. If they all have values, then an object with those primary keys is retrieve from the database. If one is retrieve, then the reference exists, and True is returned. Otherwise, false is returned. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
dataObject- - the data object whose reference is being tested.referenceName- - The name of the member to be existence tested.- Returns:
- True if no exceptions occur and the object exists in the db, false otherwise.
-
validateReferenceIsActive
This method retrieves the reference from the DB, and then tests whether the object is active. It will return false if there is no activeIndicator field on this object, if the object doesnt exist in the DB, if the field doesnt exist or cannot be cast as a boolean, if the field value is null, or if the field value is false. It will only return true if the reference bo is present, the field is present, it is a boolean and non-null, and the value is true. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
dataObject-reference-- Returns:
- true if the reference is active
-
validateReferenceIsActive
This method retrieves the reference from the DB, and then tests whether the object is active. It will return false if there is no activeIndicator field on this object, if the object doesnt exist in the DB, if the field doesnt exist or cannot be cast as a boolean, if the field value is null, or if the field value is false. It will only return true if the reference bo is present, the field is present, it is a boolean and non-null, and the value is true. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
dataObject-referenceName-- Returns:
- true if the reference is active
-
validateReferenceExistsAndIsActive
validateReferenceExistsAndIsActive intelligently tests the designated reference on the data object for both existence and active status, where appropriateIt will not test anything if the foreign-key fields for the given reference aren't filled out with values, and it will not test active status if the reference doesn't exist.
Further, it will only test active status where the correct flag is set.
On failures of either sort, it will put the relevant errors into the GlobalVariables errorMap, and return a false. If there are no failures, or nothing can be tested because the foreign-key fields arent fully filled out, it will return true and add no errors.
This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.
- Parameters:
dataObject- - the data object instance to be tested.reference- - the ReferenceDefinition to control the nature of the testing.- Returns:
- true or false as per the criteria above
-
validateReferenceExistsAndIsActive
boolean validateReferenceExistsAndIsActive(Object dataObject, String referenceName, String attributeToHighlightOnFail, String displayFieldName) This method intelligently tests the designated reference on the data object for both existence and active status, where appropriate. It will not test anything if the foreign-key fields for the given reference arent filled out with values, and it will not test active status if the reference doesnt exist. Note that it will not fail or raise any error if all of the foreign-keys are filled with a value. If this needs to be tested (ie, the 'if any field is filled, then all must be filled' rule), you'll have to do that separately. Further, it will only test active status where the correct flag is set. On failures of either sort, it will put the relevant errors into the GlobalVariables errorMap, and return a false. If there are no failures, or nothing can be tested because the foreign-key fields arent fully filled out, it will return true and add no errors. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
dataObject- - the BusinessObject instance to be tested.referenceName- - the member name on the data object 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- Returns:
- true or false as per the criteria above
-
validateDefaultExistenceChecks
This method does an existence check against all references of a BusinessObject as defined in the MaintenanceDocument.xml file for that business object. Appropriate errors will also be placed in the GlobalVariables.ErrorMap. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
dataObject- - BusinessObject instance that should be tested- Returns:
- true if all passed existence tests, false if any failed
-
validateDefaultExistenceChecksForNewCollectionItem
boolean validateDefaultExistenceChecksForNewCollectionItem(Object dataObject, Object 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. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
dataObject- parent business object instance to retrieve default checks fornewCollectionItem- new collection line to validatecollectionName- name of the collection in the parent- Returns:
- true if all passed existence tests, false if any failed
-
validateDefaultExistenceChecksForTransDoc
This method does an existence check against all references of a transactionalDocument Appropriate errors will also be placed in the GlobalVariables.ErrorMap. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
document- document instance that should be tested- Returns:
- true if all passed existence tests, false if any failed
-
validateDefaultExistenceChecksForNewCollectionItem
boolean validateDefaultExistenceChecksForNewCollectionItem(TransactionalDocument document, Object 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. This method assumes that you already have the errorPath set exactly as desired, and adds new errors to the errorMap with no prefix, other than what has already been pushed onto the errorMap.- Parameters:
document- document instance that should be testedcollectionName- that should be testedaccountingLine- that should be tested- Returns:
- true if all passed existence tests, false if any failed
-
validatePrimitiveFromDescriptor
@Deprecated void validatePrimitiveFromDescriptor(String entryName, Object object, PropertyDescriptor propertyDescriptor, String errorPrefix, boolean validateRequired) Deprecated.since 1.1
-