Last modified by David Avendasora on 2008/01/25 10:41

Show last authors
1 Add this code to the end of any other _Entity superclass template to add Model-Specified FetchSpecifications to the _Entity.java file.
2
3 {{code}}
4
5 #foreach ($fetchSpecification in $entity.sortedFetchSpecs)
6 #if (true || $fetchSpecification.distinctBindings.size() > 0)
7 public static NSArray<${entity.className}> fs${fetchSpecification.capitalizedName}(EOEditingContext context, NSDictionary<String, Object> bindings) {
8 EOFetchSpecification spec = EOFetchSpecification.fetchSpecificationNamed("${fetchSpecification.name}", "${entity.name}");
9 spec = spec.fetchSpecificationWithQualifierBindings(bindings);
10 return context.objectsWithFetchSpecification(spec);
11 }
12
13 #end
14 public static NSArray<${entity.className}> fs${fetchSpecification.capitalizedName}(EOEditingContext context#foreach ($binding in $fetchSpecification.distinctBindings),
15 ${binding.attributePath.childClassName} ${binding.name}Binding#end)
16 {
17 EOFetchSpecification spec = EOFetchSpecification.fetchSpecificationNamed("${fetchSpecification.name}", "${entity.name}");
18 #if ($fetchSpecification.distinctBindings.size() > 0)
19 NSMutableDictionary bindings = new NSMutableDictionary();
20 #foreach ($binding in $fetchSpecification.distinctBindings)
21 bindings.takeValueForKey(${binding.name}Binding, "${binding.name}");
22 #end
23 spec = spec.fetchSpecificationWithQualifierBindings(bindings);
24 #end
25 return context.objectsWithFetchSpecification(spec);
26 }
27
28 #end
29
30 {{/code}}