Re: Generate Expression from DataObject

From: Tobias SCHOESSLER (Tobias.Schoessle..nvienna.org)
Date: Thu Mar 30 2006 - 09:08:23 EST

  • Next message: Andrus Adamchik: "Re: Generate Expression from DataObject"

    Thank you Andrus,

    For me this did the trick. Given a DataObject
    ExpressionUtil.expressionFromDataObject returns an Expression matching all
    non null values of the graph. You can specify Classes to exclude from the
    recursion.
    Maybe someone finds it usefull. See source attached.

    (See attached file: ExpressionUtil.java)

                                                                               
                 Andrus Adamchik
                 <andru..bjectsty
                 le.org> To
                                           cayenne-deve..bjectstyle.org
                 Thursday, 9 March cc
                 2006 11:44
                                                                       Subject
                                           Re: Generate Expression from
                 Please respond to DataObject
                 cayenne-deve..bj
                   ectstyle.org
                                                                               
                                                                               
                                                                               
                                                                               

    It should be very easy to create such utility on your own based on
    ExpressionFactory.matchAllExp and ExpressionFactory.matchAnyExp

    Andrus

    On Mar 9, 2006, at 12:11 PM, Tobias SCHOESSLER wrote:

    >
    > Hello,
    >
    > I wondered if there is a way to generate an Expression based on
    > partially
    > set values of a DataObject.
    >
    > Motivation: Many 4GL tools provide forms for searching the database by
    > "reusing" the input form. The user fills in some values and the system
    > retrieves all entries matching those given values.
    >
    > I think this could be a quick way to prototype complex search
    > forms. For
    > Cayenne I would imagine creating a transient DataObject Net without
    > registering them in the DataContext. Setting some values, generate an
    > Expression based on the given values and run it against the database
    > retrieving 'real' DataObjects matching the value set.
    >
    > Anything there that accomplishes this?
    >
    > thanks
    > Tobias.
    > ______________________________________
    > Tobias Schoessler, Java Developer
    > Information Management Unit
    > Information Technology Service
    > United Nations Office on Drugs and Crime
    >
    > Tel: (+43-1) 26060-5173
    > Websites: www.unov.org, www.unodc.org
    > ______________________________________
    > Impossible is not a fact, only an opinion
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Mar 30 2006 - 09:08:53 EST