Re: moving to VelocityGenerator from JavaEOGenerator

From: Oswaldo Bueno (bueno.de..mail.com)
Date: Thu Jan 24 2008 - 12:27:31 EST

  • Next message: Chuck Hill: "Re: JavaClient model editing in EntityModeler"

    Hi Mike,
       I'm also having the same problem here, for example, the following template:

    #foreach ($fetchSpecification in $entity.sortedFetchSpecs)
    //distinctBindings -- $fetchSpecification.distinctBindings
    //allBindings -- $fetchSpecification.allBindings
    //qualifier -- $fetchSpecification.qualifier
    //qualifierString -- $fetchSpecification.qualifierString

      Outputs with some fetchSpecifications:

    //distinctBindings -- []
    //allBindings -- []
    //qualifier -- (modActive = 1) and (modParentId = null) and
    (modLevel <= $level)
    //qualifierString -- (modActive = 1) and (modParentId = null) and
    (modLevel <= $level)

    or

    //distinctBindings -- []
    //allBindings -- []
    //qualifier -- lang = $lang
    //qualifierString -- lang = $lang

    And sometimes it works:

    //distinctBindings -- [[EOQualifierBinding: langDictKey.dictKeyName = $dictKey]]
    //allBindings -- [[EOQualifierBinding: langDictKey.dictKeyName = $dictKey]]
    //qualifier -- langDictKey.dictKeyName like $dictKey
    //qualifierString -- langDictKey.dictKeyName like $dictKey

    First I suspected it was an error parsing OR and AND operators, but
    that is not the problem.

    Cheers,

       Bueno

    On Jan 23, 2008 2:19 PM, David LeBer <dlebe..odeferous.com> wrote:
    >
    > On 23-Jan-08, at 11:04 AM, Mike Schrag wrote:
    >
    > > What is one of the qualifiers you are using?
    >
    > (userName = $userName) and (password = $password) on my User Entity.
    >
    > I've also tried:
    >
    > (userName = $aUserName) and (password = $aPassword)
    >
    > (userName = $userName)
    >
    >
    > > ms
    > >
    > > On Jan 23, 2008, at 10:45 AM, David LeBer wrote:
    > >
    > >>
    > >> On 22-Jan-08, at 6:31 PM, Mike Schrag wrote:
    > >>
    > >>>> Thanks Mike,
    > >>>>
    > >>>> So, I want my velogen templates to generate something like this:
    > >>>>
    > >>>> public NSArray fetchSomeObjectsFetchSpec(EOEditingContext ec,
    > >>>> BindingOneClass bindingOne, BindingTwoClass bindingTwo) {
    > >>>> ...
    > >>>> }
    > >>>>
    > >>>> I get the 'bindingOne' from the EOQualifierBindings 'name', how
    > >>>> do I get the 'BindingOneClass'?
    > >>>>
    > >>>> Do i need to check the attributePath and ask for a different key
    > >>>> path based on the result to get at the destinations class or is
    > >>>> there an easier way I'm not seeing?
    > >>> I was going to give a long explanation of how you can do it, but
    > >>> it was easier to just add some easier API ... attributePath now
    > >>> has a "childClassName" method on it, so you can call $
    > >>> {binding.attributePath.childClassName} and it will do the right
    > >>> thing for attributes or relationships (EXCEPT if you use
    > >>> ERXConstants as binding values, but I don't think this will be a
    > >>> problem).
    > >>
    > >>
    > >> Did these changes make into last nights build?
    > >>
    > >> I've added this to my _Entity template:
    > >>
    > >> #foreach ($fetchSpec in $entity.sortedFetchSpecs)
    > >> public static NSArray fetch${fetchSpec.capitalizedName}
    > >> (EOEditingContext ec#foreach ($binding in
    > >> $fetchSpec.distinctBindings), ${binding.childClassName} $
    > >> {binding.name}Binding#end) {
    > >> #if ($fetchSpec.distinctBindings.count > 0)
    > >> NSMutableDictionary bindings = new NSMutableDictionary();
    > >> #foreach ($binding in $fetchSpec.distinctBindings)
    > >> if (${binding.name}Binding != null) {
    > >> bindings.setObjectForKey(${binding.name}Binding, "$
    > >> {binding.name}");
    > >> }
    > >> #end
    > >> #end
    > >> return EOUtilities.objectsWithFetchSpecificationAndBindings(ec, "$
    > >> {entity.name}", "${fetchSpec.name}", #if
    > >> ($fetchSpec.distinctBindings.count > 0) bindings);#else null);
    > >> #end
    > >> }
    > >> #end
    > >>
    > >> And it doesn't get anything for the $fetchSpec.distinctBindings
    > >> array. I checked the code for EOFetchSpecification in WOLips and it
    > >> looks like getDistinctBindings() is there.
    > >>
    > >> ... confused.
    > >>
    > >> Eclipse 3.3.2 M20071219-0800
    > >> WOLips 3.3.4777
    >
    > ;david
    >
    > --
    > David LeBer
    > Codeferous Software
    > 'co-def-er-ous' adj. Literally 'code-bearing'
    > site: http://codeferous.com
    > blog: http://davidleber.net
    > profile: http://www.linkedin.com/in/davidleber
    > --
    > Toronto Area Cocoa / WebObjects developers group:
    > http://tacow.org
    >
    >
    >

    -- 
    -----------------------------------------------------------------------------------------
    Oswaldo V. C. Bueno - http://bueno.carpintaria.com
    Carpintaria do Software - http://www.carpintaria.com
    



    This archive was generated by hypermail 2.0.0 : Thu Jan 24 2008 - 12:29:57 EST