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

java.lang.Object
  extended by org.codehaus.groovy.grails.validation.AbstractConstraint
      extended by org.codehaus.groovy.grails.orm.hibernate.validation.AbstractPersistentConstraint
          extended by org.codehaus.groovy.grails.orm.hibernate.validation.UniqueConstraint
All Implemented Interfaces:
PersistentConstraint, org.codehaus.groovy.grails.validation.Constraint, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.MessageSourceAware

public class UniqueConstraint
extends AbstractPersistentConstraint

A constraint that validates the uniqueness of a property (will query the database during validation process).

Since:
0.4

Field Summary
static java.lang.String UNIQUE_CONSTRAINT
           
 
Fields inherited from class org.codehaus.groovy.grails.orm.hibernate.validation.AbstractPersistentConstraint
applicationContext, sessionFactory
 
Fields inherited from class org.codehaus.groovy.grails.validation.AbstractConstraint
classShortName, constraintOwningClass, constraintParameter, constraintPropertyName, messageSource
 
Constructor Summary
UniqueConstraint()
           
 
Method Summary
 java.lang.String getName()
           
 java.util.List<java.lang.String> getUniquenessGroup()
           
 boolean isUnique()
           
 boolean isUniqueWithinGroup()
           
protected  void processValidate(java.lang.Object target, java.lang.Object propertyValue, org.springframework.validation.Errors errors)
           
 void setParameter(java.lang.Object constraintParameter)
           
 
Methods inherited from class org.codehaus.groovy.grails.orm.hibernate.validation.AbstractPersistentConstraint
getHibernateTemplate, isValid, setApplicationContext, supports
 
Methods inherited from class org.codehaus.groovy.grails.validation.AbstractConstraint
checkState, getDefaultMessage, getParameter, getPropertyName, rejectValue, rejectValue, rejectValue, rejectValue, rejectValue, rejectValueWithDefaultMessage, setMessageSource, setOwningClass, setPropertyName, skipBlankValues, skipNullValues, toString, validate
 
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
getParameter, getPropertyName, setMessageSource, setOwningClass, setPropertyName, validate
 

Field Detail

UNIQUE_CONSTRAINT

public static final java.lang.String UNIQUE_CONSTRAINT
See Also:
Constant Field Values
Constructor Detail

UniqueConstraint

public UniqueConstraint()
Method Detail

isUnique

public boolean isUnique()
Returns:
Returns the unique.

isUniqueWithinGroup

public boolean isUniqueWithinGroup()
Returns:
Whether the property is unique within a group

setParameter

public void setParameter(java.lang.Object constraintParameter)
Specified by:
setParameter in interface org.codehaus.groovy.grails.validation.Constraint
Overrides:
setParameter in class org.codehaus.groovy.grails.validation.AbstractConstraint

getName

public java.lang.String getName()

processValidate

protected void processValidate(java.lang.Object target,
                               java.lang.Object propertyValue,
                               org.springframework.validation.Errors errors)
Specified by:
processValidate in class org.codehaus.groovy.grails.validation.AbstractConstraint

getUniquenessGroup

public java.util.List<java.lang.String> getUniquenessGroup()