[OS-JIRA] Created: (WOL-772) Default EOGenerator templates should include support for EOFetchSpecifications

From: John Huss (JIRA) ("John)
Date: Wed Apr 02 2008 - 16:06:25 EDT

  • Next message: Lachlan Deck: "Re: Subversive or Subclipse?"

    Default EOGenerator templates should include support for EOFetchSpecifications
    ------------------------------------------------------------------------------

                     Key: WOL-772
                     URL: http://issues.objectstyle.org/jira/browse/WOL-772
                 Project: WOProject/WOLips
              Issue Type: Improvement
              Components: wolips
        Affects Versions: WOLips 3.3.* Next Stable Build
             Environment: 3.3.5409
                Reporter: John Huss
                Priority: Minor

    The default EOGenerator templates should really include some code to make use of fetch specifications. Here are the additions that I would recommend:

    1) A function that returns an EOFetchSpecification object for each fetch specification
    2) A function that performs the fetch and takes the binding values as parameters.

    The templates are below. I tried to match the indentation of the current templates and the naming conventions. This is the Java 1.5 (generic) version. It handles EOs and raw rows.

    #foreach ($fetchSpecification in $entity.sortedFetchSpecs)
      public static EOFetchSpecification ${fetchSpecification.name}FetchSpec() {
        return EOFetchSpecification.fetchSpecificationNamed("${fetchSpecification.name}", ENTITY_NAME);
      }

    #end

    #foreach ($fetchSpecification in $entity.sortedFetchSpecs)
      public static NSArray#if ($fetchSpecification.fetchEnterpriseObjects)<${entity.classNameWithoutPackage}>#else<NSDictionary>#end fetch${fetchSpecification.capitalizedName}(EOEditingContext editingContext#foreach ($binding in $fetchSpecification.distinctBindings),
        ${binding.attributePath.childClassName} ${binding.name}Binding#end) {
                              
        EOFetchSpecification spec = EOFetchSpecification.fetchSpecificationNamed("${fetchSpecification.name}", ENTITY_NAME);
    #if ($fetchSpecification.distinctBindings.size() > 0)
        NSMutableDictionary bindings = new NSMutableDictionary();
    #foreach ($binding in $fetchSpecification.distinctBindings)
        if (${binding.name}Binding != null)
          bindings.takeValueForKey(${binding.name}Binding, "${binding.name}");
    #end
        spec = spec.fetchSpecificationWithQualifierBindings(bindings);
    #end
        return editingContext.objectsWithFetchSpecification(spec);
      }

    #end

    -- 
    This message is automatically generated by JIRA.
    -
    If you think it was sent incorrectly contact one of the administrators: http://issues.objectstyle.org/jira/secure/Administrators.jspa
    -
    For more information on JIRA, see: http://www.atlassian.com/software/jira
    



    This archive was generated by hypermail 2.0.0 : Wed Apr 02 2008 - 16:07:30 EDT