Re: Another velocity EOGen question

From: Q (qdola..mail.com)
Date: Fri Nov 30 2007 - 21:54:07 EST

  • Next message: Mike Schrag: "Re: Another velocity EOGen question"

    Not sure if you have already address FetchSpec bindings in the
    velocity eogenerator yet, but I couldn't seem to find what I was
    looking for so am following this up now.

    On 19/11/2007, at 10:52 AM, Mike Schrag wrote:

    >>> <$if
    >>> javaBeautifiedFetchSpecificationDictionaries
    >>> ..ortedNameArray.@count > 0 $> // FetchSpec convenience
    >>> methods<$endif$>
    >>> <$foreach FetchSpec
    >>> javaBeautifiedFetchSpecificationDictionaries..ortedNameArray do$>
    > Q was just asking me about this, too ... I'm not sure why this thing
    > returns dictionaries in the original and what exactly is in these
    > dictionaries. You can just do entity.sortedFetchSpecs in the
    > velocity one.
    >
    >>> public static NSArray fetch<$FetchSpec.niceName
    >>> $>( EOEditingContext ec<$foreach Binding FetchSpec.bindings do2$>,
    >>> <$Binding.codeType$><
    > Not sure exactly what the semantics of "niceName" are, but there is
    > now also a uppercaseUnderscoreName, capitalizedName, and
    > initialLowercaseName on fetch spec.

    That should do it.

    > For the bindings, does anyone know what exactly that returns? Is it
    > an array of attributes corresponding to unbound attributes in the
    > qualifier?

    Yes, but it also needs to include the class type of the attribute so
    an appropriate argument string can be built from it.

    Here is what I expect the velocity version of the previous EOGen
    template should roughly look like:

    #foreach ($fetchSpec in $entity.sortedFetchSpecs)
       public static NSArray fetch${fetchSpec.name}(EOEditingContext
    ec#foreach ($binding in $fetchSpec.bindings), ${binding.codeType} $
    {binding.name}Binding#end) {
    #if ($fetchSpec.bindings.count > 0)
         NSMutableDictionary bindings = new NSMutableDictionary($
    {fetchSpec.bindings.count});
    #foreach ($binding in $fetchSpec.bindings)
         if (${binding.name}Binding != null)
                bindings.setObjectForKey(${binding.name}Binding, "$
    {binding.name}");
    #end
    #end
            return EOUtilities.objectsWithFetchSpecificationAndBindings(
              ec,
              "${entity.name}",
              "${fetchSpec.name}",
    #if ($fetchSpec.bindings.count > 0)
           bindings);
    #else
           null);
    #end
       }

    -- 
    Seeya...Q
    

    Quinton Dolan - qdola..mail.com Gold Coast, QLD, Australia (GMT+10) Ph: +61 419 729 806



    This archive was generated by hypermail 2.0.0 : Fri Nov 30 2007 - 21:55:46 EST