org.codehaus.groovy.grails.orm.hibernate.validation
Class HibernateDomainClassValidator

java.lang.Object
  extended by org.codehaus.groovy.grails.validation.GrailsDomainClassValidator
      extended by org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator
All Implemented Interfaces:
GrailsApplicationAware, CascadingValidator, ApplicationContextAware, Validator

public class HibernateDomainClassValidator
extends GrailsDomainClassValidator
implements ApplicationContextAware

A validator that first checks if the Hibernate PersistentCollection instance has been initialised before bothering to cascade

Since:
0.5

Created: Apr 13, 2007 Time: 6:32:08 PM

Author:
Graeme Rocher

Constructor Summary
HibernateDomainClassValidator()
           
 
Method Summary
protected  void cascadeValidationToMany(Errors errors, BeanWrapper bean, GrailsDomainClassProperty persistentProperty, String propertyName)
          Overrides the default behaviour and first checks if a PersistentCollection instance has been initialised using the wasInitialised() method before cascading
protected  void cascadeValidationToOne(Errors errors, BeanWrapper bean, Object associatedObject, GrailsDomainClassProperty persistentProperty, String propertyName)
          Cascades validation to a one-to-one or many-to-one property
protected  void postValidate(Object obj, Errors errors)
          Subclasses can overrite to provide custom handling of the errors object post validation
 void setApplicationContext(ApplicationContext applicationContext)
           
 
Methods inherited from class org.codehaus.groovy.grails.validation.GrailsDomainClassValidator
cascadeToAssociativeProperty, getDomainClass, setDomainClass, setGrailsApplication, setMessageSource, supports, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateDomainClassValidator

public HibernateDomainClassValidator()
Method Detail

cascadeValidationToMany

protected void cascadeValidationToMany(Errors errors,
                                       BeanWrapper bean,
                                       GrailsDomainClassProperty persistentProperty,
                                       String propertyName)
Overrides the default behaviour and first checks if a PersistentCollection instance has been initialised using the wasInitialised() method before cascading

Overrides:
cascadeValidationToMany in class GrailsDomainClassValidator
Parameters:
errors - The Spring Errors instance
bean - The BeanWrapper for the bean
persistentProperty - The GrailsDomainClassProperty instance
propertyName - The name of the property
See Also:
PersistentCollection.wasInitialized()

cascadeValidationToOne

protected void cascadeValidationToOne(Errors errors,
                                      BeanWrapper bean,
                                      Object associatedObject,
                                      GrailsDomainClassProperty persistentProperty,
                                      String propertyName)
Description copied from class: GrailsDomainClassValidator
Cascades validation to a one-to-one or many-to-one property

Overrides:
cascadeValidationToOne in class GrailsDomainClassValidator
Parameters:
errors - The Errors instance
bean - The original BeanWrapper
associatedObject - The associated object's current value
persistentProperty - The GrailsDomainClassProperty instance
propertyName - The name of the property

postValidate

protected void postValidate(Object obj,
                            Errors errors)
Description copied from class: GrailsDomainClassValidator
Subclasses can overrite to provide custom handling of the errors object post validation

Overrides:
postValidate in class GrailsDomainClassValidator
Parameters:
obj - The object to validate
errors - The Errors object

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException


Copyright (c) 2005-2009 The Grails project