## org.codehaus.groovy.grails.orm.hibernate.validation
Class AbstractPersistentConstraint

    java.lang.Object
      org.codehaus.groovy.grails.validation.AbstractConstraint
          org.codehaus.groovy.grails.orm.hibernate.validation.AbstractPersistentConstraint

All Implemented Interfaces:
  PersistentConstraint, Constraint, ApplicationContextAware

Direct Known Subclasses:
  UniqueConstraint

    abstract class AbstractPersistentConstraint

extends AbstractConstraint
implements PersistentConstraint

Constraints that require access to the HibernateTemplate should subclass this class

Since:
  0.4

  Created: Jan 23, 2007 Time: 1:58:21 PM
Author:
  Graeme Rocher

Field Summary

Fields inherited from class org.codehaus.groovy.grails.validation.AbstractConstraint
`classShortName, constraintOwningClass, constraintParameter, constraintPropertyName, messageSource`

Constructor Summary
`AbstractPersistentConstraint()`

Method Summary
`HibernateTemplate` `getHibernateTemplate()` Obtains the HibernateTemplate
`void` `setApplicationContext(ApplicationContext applicationContext)`
`void` `validate(Object target, Object propertyValue, Errors errors)` Validate this constraint against a property value.

Methods inherited from class org.codehaus.groovy.grails.validation.AbstractConstraint
`checkState, getDefaultMessage, getPropertyName, processValidate, rejectValue, rejectValue, rejectValue, rejectValue, rejectValue, rejectValueWithDefaultMessage, setMessageSource, setOwningClass, setParameter, setPropertyName, skipBlankValues, skipNullValues, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.codehaus.groovy.grails.validation.Constraint
`getName, getPropertyName, setMessageSource, setOwningClass, setParameter, setPropertyName, supports`

Constructor Detail

### AbstractPersistentConstraint

    AbstractPersistentConstraint()

Method Detail

### setApplicationContext

    public void setApplicationContext(ApplicationContext applicationContext)
                               throws BeansException

  Specified by:
    `setApplicationContext` in interface `ApplicationContextAware`
  Throws:
    `BeansException`

### getHibernateTemplate

    public HibernateTemplate getHibernateTemplate()

  Description copied from interface: `PersistentConstraint`
  Obtains the HibernateTemplate

  Specified by:
    `getHibernateTemplate` in interface `PersistentConstraint`
  Returns:
    The HibernateTemplate instance

### validate

    public void validate(Object target,
                         Object propertyValue,
                         Errors errors)

  Description copied from interface: `Constraint`
  Validate this constraint against a property value. If implementation is vetoing (isVetoing() method returns true), then it could return 'true' to stop further validation.

  Specified by:
    `validate` in interface `Constraint`
  Overrides:
    `validate` in class `AbstractConstraint`
    `propertyValue` - The property value to validate
    `errors` - The errors instance to record errors against

Copyright (c) 2005-2009 The Grails project