To edit or add content to this Wiki, you can simply create a new account at http://wocommunity.org/account.

Skip to end of metadata
Go to start of metadata

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

#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
  • No labels