Inverting an expression

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Fri Jun 05 2009 - 06:24:07 EDT

  • Next message: Andrus Adamchik: "Re: Best way to turn a DataRow into an Object instance in ROP client?"

    I've got an expression that returns all "incidents" that matches
    the area of responsibility for a "user".

    Is there a way to programatically invert such an expression to return all "user"
    who are responsible for an "incident"?

    The problem with a manual conversion is that it introduces the changes of
    bugs creeping in.

    A trivial example:

    exp=ExpressionFactory.matchExp(Incident.TO_USER, user) => all incidents assigned
    to a user.

    exp=ExpressionFactory.matchExp(User.TO_INCIDENT, incident) => all users assigned
    to an incident.

    A more complicated example by throwing in roles:

    exp=exp.orExp(ExpressionFactory.matchExp(Incident.TO_ROLE + "+." +
    Role.TO_MEMBER_ARRAY + "." + Member.TO_USER, user))

    => return all incidents where a user is the member of the role who's
    responsible.

    The trick here is that the role is optional, so an outer join is used.

    I need the reverse query that returns all the users responsible for an
    incident...

    -- 
    Øyvind Harboe
    Embedded software and hardware consulting services
    http://consulting.zylin.com
    



    This archive was generated by hypermail 2.0.0 : Fri Jun 05 2009 - 06:24:43 EDT