From 70f5d92e5ef189084082a33a93457b48f6025504 Mon Sep 17 00:00:00 2001 From: rentzsch Date: Wed, 2 Mar 2011 21:24:49 -0600 Subject: [PATCH] [DEV] regenerator test mule files with 1.22 templates --- mogeneratorTestMule/MOs/_ChildMO.h | 19 ++++ mogeneratorTestMule/MOs/_ChildMO.m | 22 +++-- mogeneratorTestMule/MOs/_HumanMO.h | 29 ++++++ mogeneratorTestMule/MOs/_HumanMO.m | 34 ++++++-- mogeneratorTestMule/MOs/_ParentMO.h | 131 ++++++++++++++++++++++++++++ mogeneratorTestMule/MOs/_ParentMO.m | 109 +++++++++++++++++++++-- mogeneratorTestMule/MOs/include.m | 8 +- 7 files changed, 326 insertions(+), 26 deletions(-) diff --git a/mogeneratorTestMule/MOs/_ChildMO.h b/mogeneratorTestMule/MOs/_ChildMO.h index f817fd92..fa68ac98 100644 --- a/mogeneratorTestMule/MOs/_ChildMO.h +++ b/mogeneratorTestMule/MOs/_ChildMO.h @@ -6,6 +6,8 @@ @class ParentMO; + + @interface ChildMOID : NSManagedObjectID {} @end @@ -34,8 +36,25 @@ + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent_ error:(NSError**)error_; + @end @interface _ChildMO (CoreDataGeneratedAccessors) +@end + +@interface _ChildMO (CoreDataGeneratedPrimitiveAccessors) + + +- (NSString*)primitiveChildName; +- (void)setPrimitiveChildName:(NSString*)value; + + + + + +- (ParentMO*)primitiveParent; +- (void)setPrimitiveParent:(ParentMO*)value; + + @end diff --git a/mogeneratorTestMule/MOs/_ChildMO.m b/mogeneratorTestMule/MOs/_ChildMO.m index 4b56a9d5..2ae4988c 100644 --- a/mogeneratorTestMule/MOs/_ChildMO.m +++ b/mogeneratorTestMule/MOs/_ChildMO.m @@ -19,13 +19,20 @@ + (NSString*)entityName { + (NSEntityDescription*)entityInManagedObjectContext:(NSManagedObjectContext*)moc_ { NSParameterAssert(moc_); - return [NSEntityDescription entityForName: @"Child" inManagedObjectContext: moc_]; + return [NSEntityDescription entityForName:@"Child" inManagedObjectContext:moc_]; } - (ChildMOID*)objectID { return (ChildMOID*)[super objectID]; } ++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { + NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key]; + + + return keyPaths; +} + @@ -43,6 +50,8 @@ - (ChildMOID*)objectID { + + + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent_ { NSError *error = nil; NSArray *result = [self fetchByParent:moc_ parent:parent_ error:&error]; @@ -56,16 +65,19 @@ + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent return result; } + (NSArray*)fetchByParent:(NSManagedObjectContext*)moc_ parent:(ParentMO*)parent_ error:(NSError**)error_ { + NSParameterAssert(moc_); NSError *error = nil; NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel]; - NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"byParent" - substitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys: + + NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys: parent_, @"parent", - nil] - ]; + nil]; + + NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"byParent" + substitutionVariables:substitutionVariables]; NSAssert(fetchRequest, @"Can't find fetch request named \"byParent\"."); NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error]; diff --git a/mogeneratorTestMule/MOs/_HumanMO.h b/mogeneratorTestMule/MOs/_HumanMO.h index 296d70e5..60e183a4 100644 --- a/mogeneratorTestMule/MOs/_HumanMO.h +++ b/mogeneratorTestMule/MOs/_HumanMO.h @@ -6,6 +6,10 @@ @class NSManagedObject; + + + + @interface HumanMOID : NSManagedObjectID {} @end @@ -52,8 +56,33 @@ + (NSArray*)fetchAllHumans:(NSManagedObjectContext*)moc_ error:(NSError**)error_; + @end @interface _HumanMO (CoreDataGeneratedAccessors) +@end + +@interface _HumanMO (CoreDataGeneratedPrimitiveAccessors) + + +- (NSData*)primitiveHairColorStorage; +- (void)setPrimitiveHairColorStorage:(NSData*)value; + + + + +- (NSString*)primitiveHumanName; +- (void)setPrimitiveHumanName:(NSString*)value; + + + + + + + +- (NSManagedObject*)primitiveMeaninglessRelationship; +- (void)setPrimitiveMeaninglessRelationship:(NSManagedObject*)value; + + @end diff --git a/mogeneratorTestMule/MOs/_HumanMO.m b/mogeneratorTestMule/MOs/_HumanMO.m index 47a3cd19..12a5a78e 100644 --- a/mogeneratorTestMule/MOs/_HumanMO.m +++ b/mogeneratorTestMule/MOs/_HumanMO.m @@ -19,13 +19,20 @@ + (NSString*)entityName { + (NSEntityDescription*)entityInManagedObjectContext:(NSManagedObjectContext*)moc_ { NSParameterAssert(moc_); - return [NSEntityDescription entityForName: @"Human" inManagedObjectContext: moc_]; + return [NSEntityDescription entityForName:@"Human" inManagedObjectContext:moc_]; } - (HumanMOID*)objectID { return (HumanMOID*)[super objectID]; } ++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { + NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key]; + + + return keyPaths; +} + @@ -52,6 +59,8 @@ - (HumanMOID*)objectID { + + + (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ { NSError *error = nil; NSArray *result = [self fetchByHumanName:moc_ humanName:humanName_ error:&error]; @@ -65,16 +74,19 @@ + (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*) return result; } + (NSArray*)fetchByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ error:(NSError**)error_ { + NSParameterAssert(moc_); NSError *error = nil; NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel]; - NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"byHumanName" - substitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys: + + NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys: humanName_, @"humanName", - nil] - ]; + nil]; + + NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"byHumanName" + substitutionVariables:substitutionVariables]; NSAssert(fetchRequest, @"Can't find fetch request named \"byHumanName\"."); NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error]; @@ -97,14 +109,17 @@ + (id)fetchOneByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)hum return result; } + (id)fetchOneByHumanName:(NSManagedObjectContext*)moc_ humanName:(NSString*)humanName_ error:(NSError**)error_ { + NSParameterAssert(moc_); NSError *error = nil; NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel]; + NSDictionary *substitutionVariables = [NSDictionary dictionaryWithObjectsAndKeys: humanName_, @"humanName", nil]; + NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"oneByHumanName" substitutionVariables:substitutionVariables]; NSAssert(fetchRequest, @"Can't find fetch request named \"oneByHumanName\"."); @@ -147,14 +162,15 @@ + (NSArray*)fetchAllHumans:(NSManagedObjectContext*)moc_ { return result; } + (NSArray*)fetchAllHumans:(NSManagedObjectContext*)moc_ error:(NSError**)error_ { + NSParameterAssert(moc_); NSError *error = nil; NSManagedObjectModel *model = [[moc_ persistentStoreCoordinator] managedObjectModel]; + + NSDictionary *substitutionVariables = [NSDictionary dictionary]; + NSFetchRequest *fetchRequest = [model fetchRequestFromTemplateWithName:@"allHumans" - substitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys: - - nil] - ]; + substitutionVariables:substitutionVariables]; NSAssert(fetchRequest, @"Can't find fetch request named \"allHumans\"."); NSArray *result = [moc_ executeFetchRequest:fetchRequest error:&error]; diff --git a/mogeneratorTestMule/MOs/_ParentMO.h b/mogeneratorTestMule/MOs/_ParentMO.h index f274ac51..c9595a89 100644 --- a/mogeneratorTestMule/MOs/_ParentMO.h +++ b/mogeneratorTestMule/MOs/_ParentMO.h @@ -6,6 +6,21 @@ @class ChildMO; + + +@class NSObject; + + +@class NSColor; + + + + + + + + + @interface ParentMOID : NSManagedObjectID {} @end @@ -135,6 +150,7 @@ + @end @interface _ParentMO (CoreDataGeneratedAccessors) @@ -144,4 +160,119 @@ - (void)addChildrenObject:(ChildMO*)value_; - (void)removeChildrenObject:(ChildMO*)value_; +@end + +@interface _ParentMO (CoreDataGeneratedPrimitiveAccessors) + + +- (NSNumber*)primitiveMyInt16Transient; +- (void)setPrimitiveMyInt16Transient:(NSNumber*)value; + +- (short)primitiveMyInt16TransientValue; +- (void)setPrimitiveMyInt16TransientValue:(short)value_; + + + + +- (NSString*)primitiveParentName; +- (void)setPrimitiveParentName:(NSString*)value; + + + + +- (NSObject*)primitiveMyTransformableSansClassName; +- (void)setPrimitiveMyTransformableSansClassName:(NSObject*)value; + + + + +- (NSDecimalNumber*)primitiveMyDecimal; +- (void)setPrimitiveMyDecimal:(NSDecimalNumber*)value; + + + + +- (NSDate*)primitiveMyDate; +- (void)setPrimitiveMyDate:(NSDate*)value; + + + + +- (NSColor*)primitiveMyTransformableWithClassName; +- (void)setPrimitiveMyTransformableWithClassName:(NSColor*)value; + + + + +- (NSNumber*)primitiveMyBoolean; +- (void)setPrimitiveMyBoolean:(NSNumber*)value; + +- (BOOL)primitiveMyBooleanValue; +- (void)setPrimitiveMyBooleanValue:(BOOL)value_; + + + + +- (NSNumber*)primitiveMyInt64; +- (void)setPrimitiveMyInt64:(NSNumber*)value; + +- (long long)primitiveMyInt64Value; +- (void)setPrimitiveMyInt64Value:(long long)value_; + + + + +- (NSNumber*)primitiveMyDouble; +- (void)setPrimitiveMyDouble:(NSNumber*)value; + +- (double)primitiveMyDoubleValue; +- (void)setPrimitiveMyDoubleValue:(double)value_; + + + + +- (NSNumber*)primitiveMyInt16; +- (void)setPrimitiveMyInt16:(NSNumber*)value; + +- (short)primitiveMyInt16Value; +- (void)setPrimitiveMyInt16Value:(short)value_; + + + + +- (NSNumber*)primitiveMyFloat; +- (void)setPrimitiveMyFloat:(NSNumber*)value; + +- (float)primitiveMyFloatValue; +- (void)setPrimitiveMyFloatValue:(float)value_; + + + + +- (NSData*)primitiveMyBinaryData; +- (void)setPrimitiveMyBinaryData:(NSData*)value; + + + + +- (NSString*)primitiveMyString; +- (void)setPrimitiveMyString:(NSString*)value; + + + + +- (NSNumber*)primitiveMyInt32; +- (void)setPrimitiveMyInt32:(NSNumber*)value; + +- (int)primitiveMyInt32Value; +- (void)setPrimitiveMyInt32Value:(int)value_; + + + + + +- (NSMutableSet*)primitiveChildren; +- (void)setPrimitiveChildren:(NSMutableSet*)value; + + @end diff --git a/mogeneratorTestMule/MOs/_ParentMO.m b/mogeneratorTestMule/MOs/_ParentMO.m index 6f16f0b3..b011f21a 100644 --- a/mogeneratorTestMule/MOs/_ParentMO.m +++ b/mogeneratorTestMule/MOs/_ParentMO.m @@ -19,13 +19,48 @@ + (NSString*)entityName { + (NSEntityDescription*)entityInManagedObjectContext:(NSManagedObjectContext*)moc_ { NSParameterAssert(moc_); - return [NSEntityDescription entityForName: @"Parent" inManagedObjectContext: moc_]; + return [NSEntityDescription entityForName:@"Parent" inManagedObjectContext:moc_]; } - (ParentMOID*)objectID { return (ParentMOID*)[super objectID]; } ++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { + NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key]; + + if ([key isEqualToString:@"myInt16TransientValue"]) { + NSSet *affectingKey = [NSSet setWithObject:@"myInt16Transient"]; + keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; + } + if ([key isEqualToString:@"myBooleanValue"]) { + NSSet *affectingKey = [NSSet setWithObject:@"myBoolean"]; + keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; + } + if ([key isEqualToString:@"myInt64Value"]) { + NSSet *affectingKey = [NSSet setWithObject:@"myInt64"]; + keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; + } + if ([key isEqualToString:@"myDoubleValue"]) { + NSSet *affectingKey = [NSSet setWithObject:@"myDouble"]; + keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; + } + if ([key isEqualToString:@"myInt16Value"]) { + NSSet *affectingKey = [NSSet setWithObject:@"myInt16"]; + keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; + } + if ([key isEqualToString:@"myFloatValue"]) { + NSSet *affectingKey = [NSSet setWithObject:@"myFloat"]; + keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; + } + if ([key isEqualToString:@"myInt32Value"]) { + NSSet *affectingKey = [NSSet setWithObject:@"myInt32"]; + keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKey]; + } + + return keyPaths; +} + @@ -35,13 +70,21 @@ - (ParentMOID*)objectID { - (short)myInt16TransientValue { NSNumber *result = [self myInt16Transient]; - return result ? [result shortValue] : 0; + return [result shortValue]; } - (void)setMyInt16TransientValue:(short)value_ { [self setMyInt16Transient:[NSNumber numberWithShort:value_]]; } +- (short)primitiveMyInt16TransientValue { + NSNumber *result = [self primitiveMyInt16Transient]; + return [result shortValue]; +} + +- (void)setPrimitiveMyInt16TransientValue:(short)value_ { + [self setPrimitiveMyInt16Transient:[NSNumber numberWithShort:value_]]; +} @@ -88,13 +131,21 @@ - (void)setMyInt16TransientValue:(short)value_ { - (BOOL)myBooleanValue { NSNumber *result = [self myBoolean]; - return result ? [result boolValue] : 0; + return [result boolValue]; } - (void)setMyBooleanValue:(BOOL)value_ { [self setMyBoolean:[NSNumber numberWithBool:value_]]; } +- (BOOL)primitiveMyBooleanValue { + NSNumber *result = [self primitiveMyBoolean]; + return [result boolValue]; +} + +- (void)setPrimitiveMyBooleanValue:(BOOL)value_ { + [self setPrimitiveMyBoolean:[NSNumber numberWithBool:value_]]; +} @@ -106,13 +157,21 @@ - (void)setMyBooleanValue:(BOOL)value_ { - (long long)myInt64Value { NSNumber *result = [self myInt64]; - return result ? [result longLongValue] : 0; + return [result longLongValue]; } - (void)setMyInt64Value:(long long)value_ { [self setMyInt64:[NSNumber numberWithLongLong:value_]]; } +- (long long)primitiveMyInt64Value { + NSNumber *result = [self primitiveMyInt64]; + return [result longLongValue]; +} + +- (void)setPrimitiveMyInt64Value:(long long)value_ { + [self setPrimitiveMyInt64:[NSNumber numberWithLongLong:value_]]; +} @@ -124,13 +183,21 @@ - (void)setMyInt64Value:(long long)value_ { - (double)myDoubleValue { NSNumber *result = [self myDouble]; - return result ? [result doubleValue] : 0; + return [result doubleValue]; } - (void)setMyDoubleValue:(double)value_ { [self setMyDouble:[NSNumber numberWithDouble:value_]]; } +- (double)primitiveMyDoubleValue { + NSNumber *result = [self primitiveMyDouble]; + return [result doubleValue]; +} + +- (void)setPrimitiveMyDoubleValue:(double)value_ { + [self setPrimitiveMyDouble:[NSNumber numberWithDouble:value_]]; +} @@ -142,13 +209,21 @@ - (void)setMyDoubleValue:(double)value_ { - (short)myInt16Value { NSNumber *result = [self myInt16]; - return result ? [result shortValue] : 0; + return [result shortValue]; } - (void)setMyInt16Value:(short)value_ { [self setMyInt16:[NSNumber numberWithShort:value_]]; } +- (short)primitiveMyInt16Value { + NSNumber *result = [self primitiveMyInt16]; + return [result shortValue]; +} + +- (void)setPrimitiveMyInt16Value:(short)value_ { + [self setPrimitiveMyInt16:[NSNumber numberWithShort:value_]]; +} @@ -160,13 +235,21 @@ - (void)setMyInt16Value:(short)value_ { - (float)myFloatValue { NSNumber *result = [self myFloat]; - return result ? [result floatValue] : 0; + return [result floatValue]; } - (void)setMyFloatValue:(float)value_ { [self setMyFloat:[NSNumber numberWithFloat:value_]]; } +- (float)primitiveMyFloatValue { + NSNumber *result = [self primitiveMyFloat]; + return [result floatValue]; +} + +- (void)setPrimitiveMyFloatValue:(float)value_ { + [self setPrimitiveMyFloat:[NSNumber numberWithFloat:value_]]; +} @@ -192,13 +275,21 @@ - (void)setMyFloatValue:(float)value_ { - (int)myInt32Value { NSNumber *result = [self myInt32]; - return result ? [result intValue] : 0; + return [result intValue]; } - (void)setMyInt32Value:(int)value_ { [self setMyInt32:[NSNumber numberWithInt:value_]]; } +- (int)primitiveMyInt32Value { + NSNumber *result = [self primitiveMyInt32]; + return [result intValue]; +} + +- (void)setPrimitiveMyInt32Value:(int)value_ { + [self setPrimitiveMyInt32:[NSNumber numberWithInt:value_]]; +} @@ -217,4 +308,6 @@ - (NSMutableSet*)childrenSet { + + @end diff --git a/mogeneratorTestMule/MOs/include.m b/mogeneratorTestMule/MOs/include.m index 3372d200..0f91b3cd 100644 --- a/mogeneratorTestMule/MOs/include.m +++ b/mogeneratorTestMule/MOs/include.m @@ -1,6 +1,6 @@ -#include "ParentMO.m" -#include "_ParentMO.m" -#include "HumanMO.m" -#include "_HumanMO.m" #include "ChildMO.m" #include "_ChildMO.m" +#include "HumanMO.m" +#include "_HumanMO.m" +#include "ParentMO.m" +#include "_ParentMO.m"