Re: Another velocity EOGen question

From: Fabian Peters (lists.fabia..-lumo.com)
Date: Mon Nov 19 2007 - 07:12:34 EST

  • Next message: Fabian Peters: "Re: initialLowercase in velocity templates?"

    Hi Mike,

    >>> <$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.

    Thanks, that works fine.

    >>> 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.

    "name" seems to do just fine for me, I have no clue how "niceName"
    mangles the name.

    The complete method looks like this in the old template:

    > <$foreach FetchSpec
    > javaBeautifiedFetchSpecificationDictionaries..ortedNameArray do$>
    > public static NSArray fetch<$FetchSpec.niceName$>(EOEditingContext
    > ec<$foreach Binding FetchSpec.bindings do2$>, <$Binding.codeType$><
    > $Binding.name$>Binding<$endforeach do2$>) {
    > NSArray result = null;
    > <$if FetchSpec.bindings..ount > 0 $>
    > NSMutableDictionary bindings = new NSMutableDictionary(<
    > $FetchSpec.bindings..ount$>);<$foreach Binding FetchSpec.bindings
    > do2$>
    > if(<$Binding.name$>Binding != null)
    > bindings.setObjectForKey(<$Binding.name$>Binding, "<$Binding.name
    > $>");<$endforeach do2$><$endif$>
    > try {
    > result = EOUtilities.objectsWithFetchSpecificationAndBindings(
    > ec,
    > "<$name$>",
    > "<$FetchSpec.fetchName$>",
    > <$if FetchSpec.bindings..ount > 0$>bindings<$else$>null<$endif
    > $>);
    > } catch (EOObjectNotAvailableException e) {
    > result = new NSArray();
    > }
    > return result;
    > }
    > ...

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

    IMHO yes, with each attribute having a type and a name. At least
    that's what I can see from my templates - which I must have picked up
    from somebody at some point.

    >>> Is there any way yet to read up on what's available here?
    > The WOlips source is the only documentation for this at this point.

    Ok, helped me to avoid at least one more stupid question.

    cheers, Fabian



    This archive was generated by hypermail 2.0.0 : Mon Nov 19 2007 - 07:14:04 EST