Re: EventSubjects

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jul 21 2004 - 16:13:34 EDT

  • Next message: Holger Hoffstätte: "Re: EventSubjects"

    > Scott McClure <scot..martblob.com> wrote:
    >> Is there a list of EventSubjects somewhere? My goal is to be notified
    > before any
    >> CRUD operation occurs on a dataobject - non blocking, I will not need
    >> to preform any changes, just read the data to update a few indices.
    >
    > You might be looking for DataContextDelegate:
    >
    > http://www.objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/access/DataContextDelegate.html

    Not sure if DataContextDelegate will work for the purpose of tracking the
    data changes.

    DataRowStore.getSnapshotEventSubject() is one way to track snapshot
    changes. However it has limited use for this purpose as it was designed
    with object synchronization in mind, not data changes audit. E.g.
    generally no notification is posted for INSERT operation, etc.

    Another place is DataContext events. I wasn't a big fan of it when this
    was originally submitted, now and seems more useful to me (still I am
    looking to redesign this some more in the future :-))... So you can listen
    for DataContext.WILL_COMMIT, DID_COMMIT, DID_ROLLBACK. The problem is that
    DID_COMMIT doesn't tell you what the changes where, while WILL_COMMIT
    doesn't guarantee that the changes will succeed... Still if you just want
    to do some maintenance on commit, WILL_COMMIT should work fine.

    Like I said in the future we may want to expand that to provide more
    information, and track things at many different levels.

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed Jul 21 2004 - 16:13:35 EDT