Re: moving to VelocityGenerator from JavaEOGenerator

From: David LeBer (dlebe..odeferous.com)
Date: Wed Jan 23 2008 - 11:19:04 EST

  • Next message: David Avendasora: "Re: Unable to find framework named"

    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
    



    This archive was generated by hypermail 2.0.0 : Wed Jan 23 2008 - 11:20:11 EST