Author: torehalset Date: Tue Aug 22 13:54:33 2006 New Revision: 433749 URL: http://svn.apache.org/viewvc?rev=433749&view=rev Log: description methods, fix context setting, log property change
Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/AppController.m incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.h incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.m incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectId.m incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/AppController.m URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/AppController.m?rev=433749&r1=433748&r2=433749&view=diff ============================================================================== --- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/AppController.m (original) +++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/AppController.m Tue Aug 22 13:54:33 2006 @@ -70,7 +70,7 @@ // hessianClassName entry if(![entityName isEqualToString:@"hessianClassName"]) { - NSLog(@"found entity %@", entityName); + // NSLog(@"found entity %@", entityName); CAYObjEntity *entity = [objEntityMap objectForKey:entityName]; Class cl = NSClassFromString([entity name]); @@ -87,7 +87,6 @@ } // update class mapping - // TODO: is this needed? [BBSHessianProxy setClassMapping:classMapping]; CAYNamedQuery *query = [[CAYNamedQuery alloc] init]; Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m?rev=433749&r1=433748&r2=433749&view=diff ============================================================================== --- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m (original) +++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m Tue Aug 22 13:54:33 2006 @@ -28,6 +28,7 @@ -(void)setName:(NSString *)n { + [[self objectContext] propertyChanged:self forProperty:@"name" fromOld:[values objectForKey:@"name"] toNew:n]; [values setObject:n forKey:@"name"]; } @@ -38,6 +39,7 @@ -(void)setDateOfBirth:(NSDate *)d { + [[self objectContext] propertyChanged:self forProperty:@"dateOfBirth" fromOld:[values objectForKey:@"dateOfBirth"] toNew:d]; [values setObject:d forKey:@"dateOfBirth"]; } Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.h URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.h?rev=433749&r1=433748&r2=433749&view=diff ============================================================================== --- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.h (original) +++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.h Tue Aug 22 13:54:33 2006 @@ -20,4 +20,6 @@ -(void)setConnection:(CAYClientConnection *)c; -(CAYClientConnection *)connection; +-(void) propertyChanged:(CAYPersistentObject *)object forProperty:(NSString *)property fromOld:(id)oldValue toNew:(id)newValue; + @end Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.m URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.m?rev=433749&r1=433748&r2=433749&view=diff ============================================================================== --- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.m (original) +++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectContext.m Tue Aug 22 13:54:33 2006 @@ -20,10 +20,8 @@ [queryMessage setQuery:query]; id result = [[self connection] sendMessage:queryMessage]; [queryMessage release]; - NSArray *results = [result results]; - NSArray *rows = [results objectAtIndex:0]; // connect objects to the context @@ -32,7 +30,7 @@ for(i = 0; i < n; i++) { id row = [rows objectAtIndex:i]; - if([row isMemberOfClass:[CAYPersistentObject class]]) + if([row isKindOfClass:[CAYPersistentObject class]]) { [row setObjectContext:self]; // TODO: set initial persistant state @@ -41,6 +39,11 @@ NSLog(@"query rows: %@", rows); return rows; +} + +-(void) propertyChanged:(CAYPersistentObject *)object forProperty:(NSString *)property fromOld:(id)oldValue toNew:(id)newValue +{ + NSLog(@"prop %@ changed from %@ to %@", property, oldValue, newValue); } -(void)setConnection:(CAYClientConnection *)c Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectId.m URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectId.m?rev=433749&r1=433748&r2=433749&view=diff ============================================================================== --- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectId.m (original) +++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjectId.m Tue Aug 22 13:54:33 2006 @@ -159,4 +159,20 @@ return YES; } +-(NSString *)description +{ + NSString *result; + /* + NSString *entityName; + NSDictionary *objectIdKeys; + NSString *singleKey; + NSObject *singleValue; + NSData *tempKey; +*/ + result = [[NSString alloc] initWithFormat:@"{entityName = %@; objectIdKeys = %@; singleKey = %@; singleValue = [EMAIL PROTECTED]", [self entityName], [self objectIdKeys], [self singleKey], [self singleValue]]; + [result autorelease]; + return result; +} + + @end Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m?rev=433749&r1=433748&r2=433749&view=diff ============================================================================== --- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m (original) +++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m Tue Aug 22 13:54:33 2006 @@ -60,6 +60,14 @@ return objectContext; } +-(NSString *)description +{ + NSString *result; + result = [[NSString alloc] initWithFormat:@"{objectId = %@; values = [EMAIL PROTECTED]", [self objectId], values]; + [result autorelease]; + return result; +} + -(void)dealloc { [objectId release];