org.springframework.datastore.validation
Class ValidatingInterceptor

java.lang.Object
  extended by org.springframework.datastore.engine.EmptyInterceptor
      extended by org.springframework.datastore.validation.ValidatingInterceptor
All Implemented Interfaces:
DatastoreAware, EntityInterceptor

public class ValidatingInterceptor
extends EmptyInterceptor

An EntityInterceptor that uses Spring's validation mechanism to evict objects if an error occurs

Since:
1.0

Field Summary
 
Fields inherited from class org.springframework.datastore.engine.EmptyInterceptor
datastore
 
Constructor Summary
ValidatingInterceptor()
           
 
Method Summary
 boolean beforeInsert(PersistentEntity entity, EntityAccess e)
          Called before an entity is inserted
 boolean beforeUpdate(PersistentEntity entity, EntityAccess e)
          Called before an entity is updated
protected  void onErrors(Object object, org.springframework.validation.Errors errors)
          Sub classes should override to receive error notifications
 
Methods inherited from class org.springframework.datastore.engine.EmptyInterceptor
beforeDelete, setDatastore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatingInterceptor

public ValidatingInterceptor()
Method Detail

beforeInsert

public boolean beforeInsert(PersistentEntity entity,
                            EntityAccess e)
Description copied from interface: EntityInterceptor
Called before an entity is inserted

Specified by:
beforeInsert in interface EntityInterceptor
Overrides:
beforeInsert in class EmptyInterceptor
Parameters:
entity - The entity
e - The object
Returns:
False if the operation should be cancelled

beforeUpdate

public boolean beforeUpdate(PersistentEntity entity,
                            EntityAccess e)
Description copied from interface: EntityInterceptor
Called before an entity is updated

Specified by:
beforeUpdate in interface EntityInterceptor
Overrides:
beforeUpdate in class EmptyInterceptor
Parameters:
entity - The entity
e - The object
Returns:
False if the operation should be cancelled

onErrors

protected void onErrors(Object object,
                        org.springframework.validation.Errors errors)
Sub classes should override to receive error notifications

Parameters:
object - The object being validated
errors - The errors instance