Package org.apache.cayenne.access
Interface DataContextDelegate
public interface DataContextDelegate
Defines API for a DataContext "delegate" - an object that is temporarily passed control
 by DataContext at some critical points in the normal flow of execution. A delegate thus
 can modify the flow, abort an operation, modify the objects participating in an
 operation, or perform any other tasks it deems necessary. DataContextDelegate is shared
 by DataContext and its ObjectStore.
- Since:
- 1.1
- See Also:
- DataContext
- 
Method SummaryModifier and Type Method Description voidfinishedMergeChanges(DataObject object)Called after a successful merging of external changes to an object.voidfinishedProcessDelete(DataObject object)Called after a successful processing of externally deleted object.booleanshouldMergeChanges(DataObject object, DataRow snapshotInStore)Invoked by parent DataContext whenever an object change is detected.booleanshouldProcessDelete(DataObject object)Invoked by ObjectStore whenever it is detected that a database row was deleted for object.QuerywillPerformGenericQuery(DataContext context, Query query)Invoked before a Query is executed via DataContext.performGenericQuery.QuerywillPerformQuery(DataContext context, Query query)Invoked before a Query is executed via DataContext.performQuery.
- 
Method Details- 
willPerformQueryInvoked before a Query is executed via DataContext.performQuery. The delegate may substitute the Query with a different one or may return null to discard the query.- Since:
- 1.2
 
- 
willPerformGenericQueryInvoked before a Query is executed via DataContext.performGenericQuery. The delegate may substitute the Query with a different one or may return null to discard the query.- Since:
- 1.2
 
- 
shouldMergeChangesInvoked by parent DataContext whenever an object change is detected. This can be a change to the object snapshot, or a modification of an "independent" relationship not resulting in a snapshot change. In the later case snapshot argument may be null. If a delegate returnstrue, ObjectStore will attempt to merge the changes into an object.
- 
finishedMergeChangesCalled after a successful merging of external changes to an object. If previosly a delegate returnedfalsefromshouldMergeChanges(DataObject, DataRow), this method is not invoked, since changes were not merged.
- 
shouldProcessDeleteInvoked by ObjectStore whenever it is detected that a database row was deleted for object. If a delegate returnstrue, ObjectStore will change MODIFIED objects to NEW (resulting in recreating the deleted record on next commit) and all other objects - to TRANSIENT. To block this behavior, delegate should returnfalse, and possibly do its own processing.- Parameters:
- object- DataObject that was deleted externally and is still present in the ObjectStore associated with the delegate.
 
- 
finishedProcessDeleteCalled after a successful processing of externally deleted object. If previosly a delegate returnedfalsefromshouldProcessDelete(DataObject), this method is not invoked, since no processing was done.
 
-