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:
  • Method Details

    • willPerformQuery

      Query willPerformQuery(DataContext context, Query query)
      Invoked 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
    • willPerformGenericQuery

      Query willPerformGenericQuery(DataContext context, Query query)
      Invoked 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
    • shouldMergeChanges

      boolean shouldMergeChanges(DataObject object, DataRow snapshotInStore)
      Invoked 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 returns true, ObjectStore will attempt to merge the changes into an object.
    • finishedMergeChanges

      void finishedMergeChanges(DataObject object)
      Called after a successful merging of external changes to an object. If previosly a delegate returned false from shouldMergeChanges(DataObject, DataRow), this method is not invoked, since changes were not merged.
    • shouldProcessDelete

      boolean shouldProcessDelete(DataObject object)
      Invoked by ObjectStore whenever it is detected that a database row was deleted for object. If a delegate returns true, 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 return false, and possibly do its own processing.
      Parameters:
      object - DataObject that was deleted externally and is still present in the ObjectStore associated with the delegate.
    • finishedProcessDelete

      void finishedProcessDelete(DataObject object)
      Called after a successful processing of externally deleted object. If previosly a delegate returned false from shouldProcessDelete(DataObject), this method is not invoked, since no processing was done.