Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Add this code to the end of any other _Entity superclass template to add Model-Specified FetchSpecifications to the _Entity.java file.

Code Block
#foreach ($fetchSpecification in $entity.sortedFetchSpecs)
#if (true || $fetchSpecification.distinctBindings.size() > 0)
  public static NSArray<${entity.className}> fs${fetchSpecification.capitalizedName}(EOEditingContext context, NSDictionary<String, Object> bindings) {
    EOFetchSpecification spec = EOFetchSpecification.fetchSpecificationNamed("${fetchSpecification.name}", "${entity.name}");
    spec = spec.fetchSpecificationWithQualifierBindings(bindings);
    return context.objectsWithFetchSpecification(spec);
  }
  
#end
  public static NSArray<${entity.className}> fs${fetchSpecification.capitalizedName}(EOEditingContext context#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)
    bindings.takeValueForKey(${binding.name}Binding, "${binding.name}");
#end
    spec = spec.fetchSpecificationWithQualifierBindings(bindings);
#end
    return context.objectsWithFetchSpecification(spec);
  }
  
#end