Changeset 325 for trunk/cocoa/mogenerator
- Timestamp:
- 09/01/08 08:57:34 (4 months ago)
- Files:
-
- trunk/cocoa/mogenerator/mogenerator.m (modified) (3 diffs)
- trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/_ChildMO.h (modified) (1 diff)
- trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/_ChildMO.m (modified) (1 diff)
- trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/_HumanMO.h (modified) (1 diff)
- trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/_HumanMO.m (modified) (1 diff)
- trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/include.m (modified) (1 diff)
- trunk/cocoa/mogenerator/mogeneratorTestMule/mogeneratorTestMule_DataModel.xcdatamodel/elements (modified) (previous)
- trunk/cocoa/mogenerator/mogeneratorTestMule/mogeneratorTestMule_DataModel.xcdatamodel/layout (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cocoa/mogenerator/mogenerator.m
r319 r325 70 70 } 71 71 - (void)_processPredicate:(NSPredicate*)predicate_ bindings:(NSMutableArray*)bindings_ { 72 if (!predicate_) return; 73 72 74 if ([predicate_ isKindOfClass:[NSCompoundPredicate class]]) { 73 75 nsenumerate([(NSCompoundPredicate*)predicate_ subpredicates], NSPredicate, subpredicate) { … … 93 95 if (attribute) { 94 96 type = [attribute objectAttributeType]; 95 type = [type stringByAppendingString:@"*"];96 97 } else { 97 98 // Probably a relationship 98 assert(0&&"TODO: add relationship support"); 99 NSRelationshipDescription *relationship = [[self relationshipsByName] objectForKey:[lhs keyPath]]; 100 assert(relationship); 101 type = [[relationship destinationEntity] managedObjectClassName]; 99 102 } 103 type = [type stringByAppendingString:@"*"]; 100 104 101 105 [bindings_ addObject:[NSDictionary dictionaryWithObjectsAndKeys: … … 329 333 if (_version) 330 334 { 331 printf("mogenerator 1.1 1. By Jonathan 'Wolf' Rentzsch + friends.\n");335 printf("mogenerator 1.12. By Jonathan 'Wolf' Rentzsch + friends.\n"); 332 336 return EXIT_SUCCESS; 333 337 } trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/_ChildMO.h
r317 r325 36 36 37 37 38 39 + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent_; 40 + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent_ error:(NSError**)error_; 41 42 38 43 @end trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/_ChildMO.m
r317 r325 57 57 58 58 59 60 + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent_ { 61 NSError *error = nil; 62 NSArray *result = [self fetchByParent:moc_ parent:parent_ error:&error]; 63 if (error) { 64 [NSApp presentError:error]; 65 } 66 return result; 67 } 68 + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent_ error:(NSError**)error_ { 69 NSError *error = nil; 70 71 NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel]; 72 NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"byParent" 73 substitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys: 74 75 parent_, @"parent", 76 77 nil] 78 ]; 79 NSAssert(fetchRequest, @"Can't find fetch request named \"byParent\"."); 80 81 NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error]; 82 if (error_) *error_ = error; 83 return result; 84 } 85 86 59 87 @end trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/_HumanMO.h
r324 r325 58 58 59 59 60 61 + (NSArray*)fetchAllHumans:(NSManagedObjectContext*)moc_ ; 62 + (NSArray*)fetchAllHumans:(NSManagedObjectContext*)moc_ error:(NSError**)error_; 63 64 60 65 @end trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/_HumanMO.m
r324 r325 151 151 152 152 153 154 + (NSArray*)fetchAllHumans:(NSManagedObjectContext*)moc_ { 155 NSError *error = nil; 156 NSArray *result = [self fetchAllHumans:moc_ error:&error]; 157 if (error) { 158 [NSApp presentError:error]; 159 } 160 return result; 161 } 162 + (NSArray*)fetchAllHumans:(NSManagedObjectContext*)moc_ error:(NSError**)error_ { 163 NSError *error = nil; 164 165 NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel]; 166 NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"allHumans" 167 substitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys: 168 169 nil] 170 ]; 171 NSAssert(fetchRequest, @"Can't find fetch request named \"allHumans\"."); 172 173 NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error]; 174 if (error_) *error_ = error; 175 return result; 176 } 177 178 153 179 @end trunk/cocoa/mogenerator/mogeneratorTestMule/MOs/include.m
r319 r325 1 #include "ChildMO.m" 2 #include "_ChildMO.m" 1 3 #include "ParentMO.m" 2 4 #include "_ParentMO.m" 3 5 #include "HumanMO.m" 4 6 #include "_HumanMO.m" 5 #include "ChildMO.m"6 #include "_ChildMO.m"
