org.kuali.kfs.sys.document.validation.impl
Class CollectionValidation

java.lang.Object
  extended by org.kuali.kfs.sys.document.validation.impl.CompositeValidation
      extended by org.kuali.kfs.sys.document.validation.impl.CollectionValidation
All Implemented Interfaces:
Validation

public class CollectionValidation
extends CompositeValidation

A validation that runs a list of child validations over each member of a collection.


Field Summary
protected  String collectionProperty
           
 
Fields inherited from class org.kuali.kfs.sys.document.validation.impl.CompositeValidation
shouldQuitOnFail, subValidations
 
Constructor Summary
CollectionValidation()
           
 
Method Summary
protected  String buildPropertyName(int count)
          Here's a hack for all my homies: this method builds the property name of a specific item in a collection by chopping the presumed "s" at the end of collectionProperties, and then attaches array/list syntax to it to hold the count.
protected  Collection getCollection(org.kuali.rice.kns.rule.event.KualiDocumentEvent event)
          Based on the collection property, finds the events
 String getCollectionProperty()
          Gets the collectionProperty attribute.
 void setCollectionProperty(String collectionProperty)
          Sets the collectionProperty attribute value.
 boolean validate(AttributedDocumentEvent event)
          Iterates over each member of the collection, which is assumed to be the property of the validation event named by the given collectionProperty
protected  boolean validateEachObject(AttributedDocumentEvent event, Object objectToValidate, int count)
          Validates each object in the collection
 
Methods inherited from class org.kuali.kfs.sys.document.validation.impl.CompositeValidation
getValidations, setQuitOnFail, setValidations, shouldQuitOnFail, stageValidation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collectionProperty

protected String collectionProperty
Constructor Detail

CollectionValidation

public CollectionValidation()
Method Detail

validate

public boolean validate(AttributedDocumentEvent event)
Iterates over each member of the collection, which is assumed to be the property of the validation event named by the given collectionProperty

Specified by:
validate in interface Validation
Overrides:
validate in class CompositeValidation
Returns:
true if validation should continue, false otherwise
See Also:
org.kuali.kfs.sys.document.validation.impl.CompositeValidation#validate(java.lang.Object[])

validateEachObject

protected boolean validateEachObject(AttributedDocumentEvent event,
                                     Object objectToValidate,
                                     int count)
Validates each object in the collection

Parameters:
event - the event to validate against
objectToValidate - the object from the collection which is being validated
Returns:
true if object passed all child sub-validations, false otherwise

buildPropertyName

protected String buildPropertyName(int count)
Here's a hack for all my homies: this method builds the property name of a specific item in a collection by chopping the presumed "s" at the end of collectionProperties, and then attaches array/list syntax to it to hold the count. It'll work for most stuff, won't it?

Returns:

getCollection

protected Collection getCollection(org.kuali.rice.kns.rule.event.KualiDocumentEvent event)
Based on the collection property, finds the events

Parameters:
event -
Returns:

getCollectionProperty

public String getCollectionProperty()
Gets the collectionProperty attribute.

Returns:
Returns the collectionProperty.

setCollectionProperty

public void setCollectionProperty(String collectionProperty)
Sets the collectionProperty attribute value.

Parameters:
collectionProperty - The collectionProperty to set.


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