org.grails.datastore.gorm.events
Class AutoTimestampInterceptor

java.lang.Object
  extended by org.springframework.datastore.engine.EmptyInterceptor
      extended by org.grails.datastore.gorm.events.AutoTimestampInterceptor
All Implemented Interfaces:
DatastoreAware, EntityInterceptor, MappingContext.Listener

public class AutoTimestampInterceptor
extends EmptyInterceptor
implements MappingContext.Listener

An interceptor that adds support for GORM-style auto-timestamping

Since:
1.0

Field Summary
static String DATE_CREATED_PROPERTY
           
static String LAST_UPDATED_PROPERTY
           
 
Fields inherited from class org.springframework.datastore.engine.EmptyInterceptor
datastore
 
Constructor Summary
AutoTimestampInterceptor()
           
 
Method Summary
 boolean beforeInsert(PersistentEntity entity, EntityAccess ea)
          Called before an entity is inserted
 boolean beforeUpdate(PersistentEntity entity, EntityAccess ea)
          Called before an entity is updated
 void persistentEntityAdded(PersistentEntity entity)
          Fired when a new entity is added
 void setDatastore(Datastore datastore)
          Sets the datastore on this instance
 
Methods inherited from class org.springframework.datastore.engine.EmptyInterceptor
beforeDelete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_CREATED_PROPERTY

public static final String DATE_CREATED_PROPERTY
See Also:
Constant Field Values

LAST_UPDATED_PROPERTY

public static final String LAST_UPDATED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

AutoTimestampInterceptor

public AutoTimestampInterceptor()
Method Detail

beforeInsert

public boolean beforeInsert(PersistentEntity entity,
                            EntityAccess ea)
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
ea - The object
Returns:
False if the operation should be cancelled

beforeUpdate

public boolean beforeUpdate(PersistentEntity entity,
                            EntityAccess ea)
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
ea - The object
Returns:
False if the operation should be cancelled

setDatastore

public void setDatastore(Datastore datastore)
Description copied from interface: DatastoreAware
Sets the datastore on this instance

Specified by:
setDatastore in interface DatastoreAware
Overrides:
setDatastore in class EmptyInterceptor
Parameters:
datastore - The datastore

persistentEntityAdded

public void persistentEntityAdded(PersistentEntity entity)
Description copied from interface: MappingContext.Listener
Fired when a new entity is added

Specified by:
persistentEntityAdded in interface MappingContext.Listener
Parameters:
entity - The entity