Success (was: moving to VelocityGenerator from JavaEOGenerator)

From: David LeBer (dlebe..odeferous.com)
Date: Thu Jan 24 2008 - 14:40:06 EST

  • Next message: ashenshugar62-w..ahoo.fr: "Re : Re : Re : Re : Re : Unable to find framework named"

    On 24-Jan-08, at 12:58 PM, Mike Schrag wrote:

    > It worked for very small values of "working" ... Um yeah I'm not
    > sure how that ever worked, but I know under certain cases it DID.
    > Anyyyyhooo ... The "actually working" version is now committed, and
    > I added a shortcut on EOQualifierBinding that you can just
    > call .javaClassName on it directly rather than
    > attributePath.javaClassName.

    Hoorah!

    As of WOLips 3.3.4778 this chunk of velogen template:

    #foreach ($fetchSpec in $entity.sortedFetchSpecs)
       public static NSArray fetch${fetchSpec.capitalizedName}
    (EOEditingContext ec#foreach ($binding in
    $fetchSpec.distinctBindings), ${binding.javaClassName} $
    {binding.name}Binding#end) {
    #if ($fetchSpec.distinctBindings.size() > 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.size() > 0) bindings);#else null);
    #end

       }
    #end

    With the qualifiers:

            (userName = $userName) and (password = $password)

    Generates this:

       public static NSArray
    fetchUserForUsernameAndPassword(EOEditingContext ec, String
    passwordBinding, String userNameBinding) {
         NSMutableDictionary bindings = new NSMutableDictionary();
         if (passwordBinding != null) {
           bindings.setObjectForKey(passwordBinding, "password");
         }
         if (userNameBinding != null) {
           bindings.setObjectForKey(userNameBinding, "userName");
         }
            return EOUtilities.objectsWithFetchSpecificationAndBindings(ec,
    "User", "UserForUsernameAndPassword", bindings);
       }

    Very happy! Thanks a tonne Mike!

    ;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 : Thu Jan 24 2008 - 14:41:13 EST