Re: ObjEntity returning related entity's ObjAttribute

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Nov 03 2005 - 01:46:12 EST

  • Next message: Andrus Adamchik: "Re: intermittent exception"

    Eric,

    ObjEntity.resolvePathComponents(Expression) returns an iterator over
    the path components. So the last element of the iterator will be the
    ObjAttribute your are looking for.

    IIRC you can also do something like this, but I haven't tried this in
    a while:

    ObjAttribute a = (ObjAttribute) Expression.fromString(path).evaluate
    (objEntity);

    Andrus

    On Nov 2, 2005, at 11:54 PM, Eric Schneider wrote:

    > Hi,
    >
    > Not sure what's the best way to tackle this problem. I have a
    > generic search page that's based on an ObjEntity and a subset of
    > ObjAttributes. I use the ObjAttribute's java type to determine
    > how to properly build the qualifier for the property.
    >
    > For example, I have an entity, Patient, and I allow them to search
    > on the following properties:
    >
    > firstName
    > lastName
    > patientNumber
    > dateOfBirth
    > case.enteredOn
    >
    > All is fine until I get to "case.enteredOn", simply because it's
    > not an ObjAttribute on Patient, it's an ObjAttribute on a related
    > ObjEntity (Case). Anyone know of API that will allow me to
    > retrieve this related Attribute with an ObjEntity and a property path?
    >
    > I imagining something like this would be really helpful right now:
    >
    > ObjAttribute attribute = (ObjAttribute)
    > objEntity.getRelatedAttributeForPropertyPath("case.enteredOn");
    >
    > Unfortunately, it doesn't exist. Just checking for alternatives
    > out there before attempting to write something similar.
    >
    > Thanks in advance.
    > Eric
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Nov 03 2005 - 01:46:16 EST