source: branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireDirector.m @ 578

Revision 578, 1.1 KB checked in by gbooker, 7 years ago (diff)

Many optimizations

Line 
1#import "SapphireDirector.h"
2#import "CoreDataSupportFunctions.h"
3
4@implementation SapphireDirector
5
6+ (SapphireDirector *)director:(NSString *)director inContext:(NSManagedObjectContext *)moc
7{
8        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name == %@", director];
9        return (SapphireDirector *)doSingleFetchRequest(SapphireDirectorName, moc, predicate);
10}
11
12+ (SapphireDirector *)createDirector:(NSString *)director inContext:(NSManagedObjectContext *)moc
13{
14        SapphireDirector *ret = [SapphireDirector director:director inContext:moc];
15        if(ret != nil)
16                return ret;
17       
18        ret = [NSEntityDescription insertNewObjectForEntityForName:SapphireDirectorName inManagedObjectContext:moc];
19        ret.name = director;
20        return ret;
21}
22
23- (NSString *)fileNameValue
24{
25        return @"movie.title";
26}
27
28- (NSString *)metaFilesValue;
29{
30        return @"movies.@distinctUnionOfSets.files";
31}
32
33- (NSArray *)defaultFileSort:(NSArray *)files
34{
35        return [files sortedArrayUsingSelector:@selector(movieCompare:)];
36}
37
38- (NSString *)path
39{
40        return [super.path stringByAppendingPathComponent:self.name];
41}
42
43@end
Note: See TracBrowser for help on using the repository browser.