org.kuali.rice.krad.service.impl
Class DictionaryValidationServiceImpl

java.lang.Object
  extended by org.kuali.rice.krad.service.impl.DictionaryValidationServiceImpl
All Implemented Interfaces:
DictionaryValidationService
Direct Known Subclasses:
DictionaryValidationServiceImpl

public class DictionaryValidationServiceImpl
extends Object
implements DictionaryValidationService

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

Author:
Kuali Rice Team (rice.collab@kuali.org)

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()
          gets the list of CollectionConstraintProcessor
 List<ConstraintProvider> getConstraintProviders()
          gets the list of ConstraintProviders
 DataDictionaryService getDataDictionaryService()
          gets the DataDictionaryService
 DocumentDictionaryService getDocumentDictionaryService()
          gets the locally saved instance of @{link DocumentDictionaryService}
 List<ConstraintProcessor> getElementConstraintProcessors()
          gets the list of element ConstraintProcessor
protected  WorkflowAttributePropertyResolutionService getWorkflowAttributePropertyResolutionService()
          gets the locally saved instance of @{link WorkflowAttributePropertyResolutionService}
 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.
protected  void processCollectionConstraints(DictionaryValidationResult result, Collection<?> collection, Constrainable definition, AttributeValueReader attributeValueReader, boolean doOptionalProcessing, String validationState, StateMapping stateMapping)
          process constraints for the provided collection using the collection constraint processors
protected  void processElementConstraints(DictionaryValidationResult result, Object value, Constrainable definition, AttributeValueReader attributeValueReader, boolean doOptionalProcessing, String validationState, StateMapping stateMapping)
          process constraints for the provided value using the element constraint processors
 void setBusinessObjectService(BusinessObjectService businessObjectService)
          Sets the BusinessObjectService attribute value
 void setCollectionConstraintProcessors(List<CollectionConstraintProcessor> collectionConstraintProcessors)
          sets the list of CollectionConstraintProcessor
 void setConstraintProviders(List<ConstraintProvider> constraintProviders)
          sets a list of ConstraintProvider
 void setDataDictionaryService(DataDictionaryService dataDictionaryService)
          sets the DataDictionaryService
 void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
          sets the DocumentDictionaryService
 void setElementConstraintProcessors(List<ConstraintProcessor> elementConstraintProcessors)
          sets the list of ConstraintProcessor
 void setPersistenceService(PersistenceService persistenceService)
          Sets the PersistenceService attribute value
 void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
          sets the @{PersistenceStructureService}
 DictionaryValidationResult validate(AttributeValueReader valueReader, boolean doOptionalProcessing, String validationState, StateMapping stateMapping)
          Validates using the defined AttributeValueReader (which allows access the object being validated) against the validationState and stateMapping (if specified).
 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, String entryName, DataDictionaryEntry entry, boolean doOptionalProcessing)
          Same as {@link DictionaryValidationService#validate(Object, String, 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, boolean doOptionalProcessing)
          Validate an object with the passed in dictionary entryName and the specific attribute to be evaluated
 DictionaryValidationResult validateAgainstNextState(Object object)
          Validates the object agains the next state (or current state if there is no next state).
 DictionaryValidationResult validateAgainstState(Object object, String validationState)
          Validates the object against the state specified.
protected  void validateAttribute(DictionaryValidationResult result, AttributeValueReader attributeValueReader, boolean checkIfRequired, String validationState, StateMapping stateMapping)
          validates an attribute
protected  void validateAttribute(DictionaryValidationResult result, Constrainable definition, AttributeValueReader attributeValueReader, boolean checkIfRequired, String validationState, StateMapping stateMapping)
           
 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.
protected  void validateObject(DictionaryValidationResult result, AttributeValueReader attributeValueReader, boolean doOptionalProcessing, boolean processAttributes, String validationState, StateMapping stateMapping)
          validates an object and its attributes recursively
 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)
          validateReferenceExistsAndIsActive 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

VALIDATE_METHOD

public static final String VALIDATE_METHOD
Constant defines a validation method for an attribute value.

Value is "validate"

See Also:
Constant Field Values

dataDictionaryService

protected DataDictionaryService dataDictionaryService

businessObjectService

protected BusinessObjectService businessObjectService

persistenceService

protected PersistenceService persistenceService

documentDictionaryService

protected DocumentDictionaryService documentDictionaryService

workflowAttributePropertyResolutionService

protected WorkflowAttributePropertyResolutionService workflowAttributePropertyResolutionService

persistenceStructureService

protected PersistenceStructureService persistenceStructureService
Constructor Detail

DictionaryValidationServiceImpl

public DictionaryValidationServiceImpl()
Method Detail

newIdentitySet

protected final Set<BusinessObject> newIdentitySet()
creates a new IdentitySet.

Returns:
a new Set

validate

public DictionaryValidationResult validate(Object object)
Description copied from interface: DictionaryValidationService
Validates an object using its class name as the entry name to look up its metadata in the dictionary.

Specified by:
validate in interface DictionaryValidationService
Parameters:
object - - an object to validate
Returns:
the dictionary validation result object associated with this validation
See Also:
DictionaryValidationService.validate(java.lang.Object)

validate

public DictionaryValidationResult validate(Object object,
                                           String entryName,
                                           String attributeName,
                                           boolean doOptionalProcessing)
Description copied from interface: DictionaryValidationService
Validate an object with the passed in dictionary entryName and the specific attribute to be evaluated

Specified by:
validate in interface DictionaryValidationService
Parameters:
object - - an object to validate
entryName - - the dictionary entry name to look up the metadata associated with this object
attributeName - - the name of the attribute (field) on the object that should be validated
doOptionalProcessing - 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
See Also:
DictionaryValidationService.validate(java.lang.Object, java.lang.String, java.lang.String, boolean)

validateAgainstNextState

public DictionaryValidationResult validateAgainstNextState(Object object)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateAgainstNextState in interface DictionaryValidationService
Returns:
the dictionary validation result object associated with this validation
See Also:
DictionaryValidationService.validateAgainstNextState(Object)

validateAgainstState

public DictionaryValidationResult validateAgainstState(Object object,
                                                       String validationState)
Description copied from interface: DictionaryValidationService
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).

Specified by:
validateAgainstState in interface DictionaryValidationService
Returns:
the dictionary validation result object associated with this validation
See Also:
DictionaryValidationService.validateAgainstState(Object, String)

validate

public DictionaryValidationResult validate(Object object,
                                           String entryName,
                                           DataDictionaryEntry entry,
                                           boolean doOptionalProcessing)
Description copied from interface: DictionaryValidationService
Same as {@link DictionaryValidationService#validate(Object, String, String, boolean) except that it provides an explicit data dictionary entry to use for the purpose of validation.

Specified by:
validate in interface DictionaryValidationService
Parameters:
object - - an object to validate
entryName - - the dictionary entry name to use in association with error look ups
entry - - the dictionary entry to use for validation
doOptionalProcessing - 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
See Also:
DictionaryValidationService.validate(Object, String, DataDictionaryEntry, boolean)

validateDocument

public void validateDocument(Document document)
Description copied from interface: DictionaryValidationService
Validates the contents of a document (i.e. attributes within a document) against the data dictionary.

Specified by:
validateDocument in interface DictionaryValidationService
Parameters:
document - - document to validate
See Also:
DictionaryValidationService.validateDocument(org.kuali.rice.krad.document.Document)

validateDocumentAttribute

public void validateDocumentAttribute(Document document,
                                      String attributeName,
                                      String errorPrefix)
Description copied from interface: DictionaryValidationService
Validates the specified attribute of the given document against the data dictionary.

Specified by:
validateDocumentAttribute in interface DictionaryValidationService
See Also:
DictionaryValidationService.validateDocumentAttribute(org.kuali.rice.krad.document.Document, java.lang.String, java.lang.String)

validateDocumentAndUpdatableReferencesRecursively

public void validateDocumentAndUpdatableReferencesRecursively(Document document,
                                                              int maxDepth,
                                                              boolean validateRequired)
Description copied from interface: DictionaryValidationService
Validates the contents of a document and recursively validates any of its updatable references

Specified by:
validateDocumentAndUpdatableReferencesRecursively in interface DictionaryValidationService
Parameters:
document - the document
maxDepth - the maximum numbers of levels to recurse
validateRequired - whether to validate whether a field is required and is currently blank
See Also:
DictionaryValidationService.validateDocumentAndUpdatableReferencesRecursively(org.kuali.rice.krad.document.Document, int, boolean)

validateDocumentAndUpdatableReferencesRecursively

public void validateDocumentAndUpdatableReferencesRecursively(Document document,
                                                              int maxDepth,
                                                              boolean validateRequired,
                                                              boolean chompLastLetterSFromCollectionName)
Description copied from interface: DictionaryValidationService
Validates the contents of a document and recursively validates any of its updatable references

Specified by:
validateDocumentAndUpdatableReferencesRecursively in interface DictionaryValidationService
Parameters:
document - the document
maxDepth - the maximum numbers of levels to recurse
validateRequired - whether to validate whether a field is required and is currently blank
chompLastLetterSFromCollectionName - 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)
See Also:
DictionaryValidationService.validateDocumentAndUpdatableReferencesRecursively(org.kuali.rice.krad.document.Document, int, boolean, boolean)

validateUpdatabableReferencesRecursively

protected void validateUpdatabableReferencesRecursively(BusinessObject businessObject,
                                                        int maxDepth,
                                                        boolean validateRequired,
                                                        boolean chompLastLetterSFromCollectionName,
                                                        Set<BusinessObject> processedBOs)

isBusinessObjectValid

public boolean isBusinessObjectValid(BusinessObject businessObject)
Description copied from interface: DictionaryValidationService
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. 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)

isBusinessObjectValid

public boolean isBusinessObjectValid(BusinessObject businessObject,
                                     String prefix)
Description copied from interface: DictionaryValidationService
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. 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
prefix - - error prefix
Returns:
boolean valid or not
See Also:
DictionaryValidationService.isBusinessObjectValid(org.kuali.rice.krad.bo.BusinessObject, String)

validateBusinessObjectsRecursively

public void validateBusinessObjectsRecursively(BusinessObject businessObject,
                                               int depth)
Parameters:
businessObject - - business object to validate

validateBusinessObject

public void validateBusinessObject(BusinessObject businessObject)
Description copied from interface: DictionaryValidationService
Validates the business object primitive attributes against the data dictionary. Adds errors to the map as they are encountered.

Specified by:
validateBusinessObject in interface DictionaryValidationService
Parameters:
businessObject - - business object to validate
See Also:
DictionaryValidationService.validateBusinessObject(org.kuali.rice.krad.bo.BusinessObject)

validateBusinessObject

public void validateBusinessObject(BusinessObject businessObject,
                                   boolean validateRequired)
Description copied from interface: DictionaryValidationService
Validates the business object primitive attributes against the data dictionary. Adds errors to the map as they are encountered.

Specified by:
validateBusinessObject in interface DictionaryValidationService
Parameters:
businessObject - - business object to validate
validateRequired - - whether to execute required field checks
See Also:
DictionaryValidationService.validateBusinessObject(org.kuali.rice.krad.bo.BusinessObject, boolean)

validateBusinessObjectsFromDescriptors

protected void validateBusinessObjectsFromDescriptors(Object object,
                                                      PropertyDescriptor[] propertyDescriptors,
                                                      int depth)
iterates through the property descriptors looking for business objects or lists of business objects. calls validate method for each bo found

Parameters:
object -
propertyDescriptors -

validatePrimitiveFromDescriptor

@Deprecated
public void validatePrimitiveFromDescriptor(String entryName,
                                                       Object object,
                                                       PropertyDescriptor propertyDescriptor,
                                                       String errorPrefix,
                                                       boolean validateRequired)
Deprecated. since 1.1

calls validate format and required check for the given propertyDescriptor

Specified by:
validatePrimitiveFromDescriptor in interface DictionaryValidationService
Parameters:
entryName -
object -
propertyDescriptor -
errorPrefix -

validateReferenceExists

public boolean validateReferenceExists(BusinessObject bo,
                                       ReferenceDefinition reference)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateReferenceExists in interface DictionaryValidationService
Parameters:
bo - - The bo 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.
See Also:
DictionaryValidationService.validateReferenceExists(org.kuali.rice.krad.bo.BusinessObject, org.kuali.rice.krad.datadictionary.ReferenceDefinition)

validateReferenceExists

public boolean validateReferenceExists(BusinessObject bo,
                                       String referenceName)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateReferenceExists in interface DictionaryValidationService
Parameters:
bo - - The bo 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.
See Also:
DictionaryValidationService.validateReferenceExists(org.kuali.rice.krad.bo.BusinessObject, java.lang.String)

validateReferenceIsActive

public boolean validateReferenceIsActive(BusinessObject bo,
                                         ReferenceDefinition reference)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateReferenceIsActive in interface DictionaryValidationService
Returns:
See Also:
DictionaryValidationService.validateReferenceIsActive(org.kuali.rice.krad.bo.BusinessObject, org.kuali.rice.krad.datadictionary.ReferenceDefinition)

validateReferenceIsActive

public boolean validateReferenceIsActive(BusinessObject bo,
                                         String referenceName)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateReferenceIsActive in interface DictionaryValidationService
Returns:
See Also:
DictionaryValidationService.validateReferenceIsActive(org.kuali.rice.krad.bo.BusinessObject, String)

validateReferenceExistsAndIsActive

public boolean validateReferenceExistsAndIsActive(BusinessObject bo,
                                                  ReferenceDefinition reference)
Description copied from interface: DictionaryValidationService
validateReferenceExistsAndIsActive intelligently tests the designated reference on the bo for both existence and active status, where appropriate

It 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.

Specified by:
validateReferenceExistsAndIsActive in interface DictionaryValidationService
Parameters:
bo - - the BusinessObject instance to be tested.
reference - - the ReferenceDefinition to control the nature of the testing.
Returns:
true or false as per the criteria above
See Also:
DictionaryValidationService.validateReferenceExistsAndIsActive(org.kuali.rice.krad.bo.BusinessObject, org.kuali.rice.krad.datadictionary.ReferenceDefinition)

validateReferenceExistsAndIsActive

public boolean validateReferenceExistsAndIsActive(BusinessObject bo,
                                                  String referenceName,
                                                  String attributeToHighlightOnFail,
                                                  String displayFieldName)
Description copied from interface: DictionaryValidationService
This method intelligently tests the designated reference on the bo 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.

Specified by:
validateReferenceExistsAndIsActive in interface DictionaryValidationService
Parameters:
bo - - the BusinessObject instance to be tested.
referenceName - - the member name on the bo to be tested for existence and active-state
attributeToHighlightOnFail - - the fieldName to highlight with the error message on a failure
displayFieldName - - the human-readable display name of the failed field, to go in the error message
Returns:
true or false as per the criteria above
See Also:
DictionaryValidationService.validateReferenceExistsAndIsActive(org.kuali.rice.krad.bo.BusinessObject, String, String, String)

validateDefaultExistenceChecks

public boolean validateDefaultExistenceChecks(BusinessObject bo)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateDefaultExistenceChecks in interface DictionaryValidationService
Parameters:
bo - - BusinessObject instance that should be tested
Returns:
true if all passed existence tests, false if any failed
See Also:
DictionaryValidationService.validateDefaultExistenceChecks(org.kuali.rice.krad.bo.BusinessObject)

validateDefaultExistenceChecksForNewCollectionItem

public boolean validateDefaultExistenceChecksForNewCollectionItem(BusinessObject bo,
                                                                  BusinessObject newCollectionItem,
                                                                  String collectionName)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateDefaultExistenceChecksForNewCollectionItem in interface DictionaryValidationService
Parameters:
bo - parent business object instance to retrieve default checks for
newCollectionItem - new collection line to validate
collectionName - name of the collection in the parent
Returns:
true if all passed existence tests, false if any failed
See Also:
DictionaryValidationService.validateDefaultExistenceChecksForNewCollectionItem(org.kuali.rice.krad.bo.BusinessObject, org.kuali.rice.krad.bo.BusinessObject, java.lang.String)

validateDefaultExistenceChecksForTransDoc

public boolean validateDefaultExistenceChecksForTransDoc(TransactionalDocument document)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateDefaultExistenceChecksForTransDoc in interface DictionaryValidationService
Parameters:
document - document instance that should be tested
Returns:
true if all passed existence tests, false if any failed
See Also:
DictionaryValidationService.validateDefaultExistenceChecksForTransDoc(org.kuali.rice.krad.document.TransactionalDocument)

validateDefaultExistenceChecksForNewCollectionItem

public boolean validateDefaultExistenceChecksForNewCollectionItem(TransactionalDocument document,
                                                                  BusinessObject newCollectionItem,
                                                                  String collectionName)
Description copied from interface: DictionaryValidationService
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.

Specified by:
validateDefaultExistenceChecksForNewCollectionItem in interface DictionaryValidationService
Parameters:
document - document instance that should be tested
newCollectionItem - that should be tested
collectionName - that should be tested
Returns:
true if all passed existence tests, false if any failed
See Also:
DictionaryValidationService.validateDefaultExistenceChecksForNewCollectionItem(org.kuali.rice.krad.document.TransactionalDocument, org.kuali.rice.krad.bo.BusinessObject, String)

validate

public DictionaryValidationResult validate(AttributeValueReader valueReader,
                                           boolean doOptionalProcessing,
                                           String validationState,
                                           StateMapping stateMapping)
Validates using the defined AttributeValueReader (which allows access the object being validated) against the validationState and stateMapping (if specified). If state information is null, validates the constraints as stateless (ie all constraints apply regardless of their states attribute).

Specified by:
validate in interface DictionaryValidationService
Parameters:
valueReader - - an object to validate
doOptionalProcessing - true if the validation should do optional validation (e.g. to check if empty values are required or not), false otherwise
validationState -
stateMapping -
Returns:

processElementConstraints

protected void processElementConstraints(DictionaryValidationResult result,
                                         Object value,
                                         Constrainable definition,
                                         AttributeValueReader attributeValueReader,
                                         boolean doOptionalProcessing,
                                         String validationState,
                                         StateMapping stateMapping)
process constraints for the provided value using the element constraint processors

Parameters:
result - - used to store the validation results
value - - the object on which constraints are to be processed - the value of a complex attribute
definition - - a Data Dictionary definition e.g. ComplexAttributeDefinition
attributeValueReader - - a class that encapsulate access to both dictionary metadata and object field values
doOptionalProcessing - - true if the validation should do optional validation, false otherwise

processCollectionConstraints

protected void processCollectionConstraints(DictionaryValidationResult result,
                                            Collection<?> collection,
                                            Constrainable definition,
                                            AttributeValueReader attributeValueReader,
                                            boolean doOptionalProcessing,
                                            String validationState,
                                            StateMapping stateMapping)
process constraints for the provided collection using the collection constraint processors

Parameters:
result - - used to store the validation results
collection - - the object on which constraints are to be processed - a collection
definition - - a Data Dictionary definition e.g. CollectionDefinition
attributeValueReader - - a class that encapsulate access to both dictionary metadata and object field values
doOptionalProcessing - - true if the validation should do optional validation, false otherwise

validateAttribute

protected void validateAttribute(DictionaryValidationResult result,
                                 AttributeValueReader attributeValueReader,
                                 boolean checkIfRequired,
                                 String validationState,
                                 StateMapping stateMapping)
                          throws AttributeValidationException
validates an attribute

Parameters:
result - - used to store the validation results
attributeValueReader - - a class that encapsulate access to both dictionary metadata and object field values
checkIfRequired - - check if empty values are required or not
Throws:
AttributeValidationException

validateAttribute

protected void validateAttribute(DictionaryValidationResult result,
                                 Constrainable definition,
                                 AttributeValueReader attributeValueReader,
                                 boolean checkIfRequired,
                                 String validationState,
                                 StateMapping stateMapping)
                          throws AttributeValidationException
Parameters:
definition - - the constrainable attribute definition of a specific attribute name
Throws:
AttributeValidationException
See Also:
for the other parameters

validateObject

protected void validateObject(DictionaryValidationResult result,
                              AttributeValueReader attributeValueReader,
                              boolean doOptionalProcessing,
                              boolean processAttributes,
                              String validationState,
                              StateMapping stateMapping)
                       throws AttributeValidationException
validates an object and its attributes recursively

Parameters:
result - - used to store the validation results
attributeValueReader - - a class that encapsulate access to both dictionary metadata and object field values
doOptionalProcessing - - true if the validation should do optional validation, false otherwise
processAttributes - - if true process all attribute definitions, skip if false
Throws:
AttributeValidationException

getDataDictionaryService

public DataDictionaryService getDataDictionaryService()
gets the DataDictionaryService

Returns:
Returns the dataDictionaryService

setDataDictionaryService

public void setDataDictionaryService(DataDictionaryService dataDictionaryService)
sets the DataDictionaryService

Parameters:
dataDictionaryService - The dataDictionaryService to set

setBusinessObjectService

public void setBusinessObjectService(BusinessObjectService businessObjectService)
Sets the BusinessObjectService attribute value

Parameters:
businessObjectService - - the businessObjectService to set

setPersistenceService

public void setPersistenceService(PersistenceService persistenceService)
Sets the PersistenceService attribute value

Parameters:
persistenceService - The persistenceService to set

setPersistenceStructureService

public void setPersistenceStructureService(PersistenceStructureService persistenceStructureService)
sets the @{PersistenceStructureService}

Parameters:
persistenceStructureService - - the PersistenceStructureService to set

getWorkflowAttributePropertyResolutionService

protected WorkflowAttributePropertyResolutionService getWorkflowAttributePropertyResolutionService()
gets the locally saved instance of @{link WorkflowAttributePropertyResolutionService}

If the instance in this class has not been initialized, retrieve it using KRADServiceLocatorInternal.getWorkflowAttributePropertyResolutionService() and save locally

Returns:
the locally saved instance of WorkflowAttributePropertyResolutionService

getCollectionConstraintProcessors

public List<CollectionConstraintProcessor> getCollectionConstraintProcessors()
gets the list of CollectionConstraintProcessor

Collection constraint processors are classes that determine if a feature of a collection of objects satisfies some constraint

Returns:
the collectionConstraintProcessors

setCollectionConstraintProcessors

public void setCollectionConstraintProcessors(List<CollectionConstraintProcessor> collectionConstraintProcessors)
sets the list of CollectionConstraintProcessor

Parameters:
collectionConstraintProcessors - the collectionConstraintProcessors to set

getConstraintProviders

public List<ConstraintProvider> getConstraintProviders()
gets the list of ConstraintProviders

Constraint providers are classes that map specific constraint types to a constraint resolver, which takes a constrainable definition

Returns:
the constraintProviders

setConstraintProviders

public void setConstraintProviders(List<ConstraintProvider> constraintProviders)
sets a list of ConstraintProvider

Parameters:
constraintProviders - the constraintProviders to set

getElementConstraintProcessors

public List<ConstraintProcessor> getElementConstraintProcessors()
gets the list of element ConstraintProcessor

Element constraint processors are classes that determine if a passed value is valid for a specific constraint at the individual object or object attribute level

Returns:
the elementConstraintProcessors

setElementConstraintProcessors

public void setElementConstraintProcessors(List<ConstraintProcessor> elementConstraintProcessors)
sets the list of ConstraintProcessor

Parameters:
elementConstraintProcessors - the elementConstraintProcessors to set

getDocumentDictionaryService

public DocumentDictionaryService getDocumentDictionaryService()
gets the locally saved instance of @{link DocumentDictionaryService}

If the instance in this class has not be set, retrieve it using KRADServiceLocatorWeb.getDocumentDictionaryService() and save locally

Returns:
the locally saved instance of DocumentDictionaryService

setDocumentDictionaryService

public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
sets the DocumentDictionaryService

Parameters:
documentDictionaryService - - the DocumentDictionaryService to set


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