Re: Implementing Entity "restricting qualifier" in application?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Sep 22 2003 - 17:59:57 EDT

  • Next message: Andrus Adamchik: "Re: problem with datanode.xml"

    I definitely support having an optional qualifier attached to an
    entity. One of the planned 1.1 feature - encoding expressions to
    Strings/XML - is a prerequisite for doing that.

    For now as an easy fix I suggest another API change. Add a method like
    "willPerformQuery" to an OperationObserver interface, and then allow
    setting custom OperationObserver on DataContext. This will expand the
    delegation capabilities of Cayenne in general, and would allow to
    customize code for your particular case. Internally we can chain custom
    observer with default ones provided by Cayenne so that even a noop
    custom class wouldn't break DataContext behavior.

    Andrus

    On Monday, September 22, 2003, at 02:22 PM, Mike Kienenberger wrote:

    > In the WebObjects application that I'm porting to Cayenne, most of my
    > non-read-only entities have restricting qualifers of "INVALIDATED <>
    > 'y'",
    > where INVALIDATED is used to represent "deleted" objects (removed from
    > the
    > view of the application, but still around for business reasons) in the
    > database.
    >
    > These qualifiers reside in my database model and not in my application
    > code.
    >
    > I'm trying to determine a good way to support this in Cayenne. I
    > don't want
    > to have to programmically specify an "Invalidated <> Y" qualifier for
    > each
    > query. I can't unilaterally apply the qualifier to all queries
    > through a
    > convenience method. I'd be willing to add the code to my generated
    > class
    > template somehow, but I can't figure out a way to do it short of
    > calling
    > some kind of class reflection method since I only have a "Class"
    > variable to
    > my entity and not the ObjEntity.
    >
    > Is there an cheap way to get from a Class variable to the ObjEntity?
    >
    > Or will I need to add a static method to each of my DataObject
    > subclasses
    > and use reflection to look it up [like "public static Qualifier
    > restrictingQualifier()"]?
    >
    > Anyone have any other ideas?
    >
    > It would be nice to do this in such a way so as to allow for some
    > future
    > possibility of supporting restrictive qualifiers in the cayenne data
    > model.
    >
    >
    > Here's a reference to EOF's restricting qualifiers:
    >
    > http://developer.apple.com/documentation/WebObjects/UsingEOModeler/
    > 7ModelingInheritance/chapter_7_section_5.html
    >



    This archive was generated by hypermail 2.0.0 : Mon Sep 22 2003 - 17:54:03 EDT