org.apache.cayenne.intercept
Class ObjectContextCallbackInterceptor

java.lang.Object
  extended by org.apache.cayenne.intercept.ObjectContextDecorator
      extended by org.apache.cayenne.intercept.ObjectContextCallbackInterceptor
All Implemented Interfaces:
Serializable, ObjectContext

public class ObjectContextCallbackInterceptor
extends ObjectContextDecorator

Implements JPA-compliant "PrePersist", "PreRemove" callbacks for the ObjectContext operations.

Depending on how callbacks are registered, they are invoked either on the persistent object instances themselves or on an instance of an arbitrary listener class. Signature of a method of a persistent object is "void method()", while for a non-persistent listener it is "void method(Object)".

Since:
3.0
Author:
Andrus Adamchik
See Also:
Serialized Form

Field Summary
protected  LifecycleCallbackRegistry callbackRegistry
           
 
Fields inherited from class org.apache.cayenne.intercept.ObjectContextDecorator
context
 
Constructor Summary
ObjectContextCallbackInterceptor()
           
 
Method Summary
 void deleteObject(Persistent object)
          Deletes an object, applying "PreRemove" callbacks to it and all its cascaded dependencies.
 Persistent newObject(Class persistentClass)
          Creates a new object, applying "PrePersist" callbacks to it.
 void registerNewObject(Object object)
          Registers a new object and performs a "PrePersist" callback on it.
 void setContext(ObjectContext context)
           
 
Methods inherited from class org.apache.cayenne.intercept.ObjectContextDecorator
commitChanges, commitChangesToParent, deletedObjects, deleteObject, getChannel, getContext, getEntityResolver, getGraphManager, localObject, modifiedObjects, newObjects, performGenericQuery, performQuery, prepareForAccess, prepareForAccess, propertyChanged, rollbackChanges, rollbackChangesLocally, uncommittedObjects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callbackRegistry

protected LifecycleCallbackRegistry callbackRegistry
Constructor Detail

ObjectContextCallbackInterceptor

public ObjectContextCallbackInterceptor()
Method Detail

setContext

public void setContext(ObjectContext context)
Overrides:
setContext in class ObjectContextDecorator

newObject

public Persistent newObject(Class persistentClass)
Creates a new object, applying "PrePersist" callbacks to it.

Specified by:
newObject in interface ObjectContext
Overrides:
newObject in class ObjectContextDecorator

registerNewObject

public void registerNewObject(Object object)
Registers a new object and performs a "PrePersist" callback on it.

Specified by:
registerNewObject in interface ObjectContext
Overrides:
registerNewObject in class ObjectContextDecorator
Parameters:
object - new object that needs to be made persistent.

deleteObject

public void deleteObject(Persistent object)
                  throws DeleteDenyException
Deletes an object, applying "PreRemove" callbacks to it and all its cascaded dependencies.

Throws:
DeleteDenyException


Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.