cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From torehal...@apache.org
Subject svn commit: r433363 - in /incubator/cayenne/sandbox/CocoaCayenne/CAYClient: AppController.m Artist.h Artist.m CAYObjEntity.h CAYObjEntity.m CAYPersistentObject.h CAYPersistentObject.m
Date Mon, 21 Aug 2006 21:17:08 GMT
Author: torehalset
Date: Mon Aug 21 14:17:07 2006
New Revision: 433363

URL: http://svn.apache.org/viewvc?rev=433363&view=rev
Log:
returned artist mapped to an Artist instead of to a NSDictionary

Modified:
    incubator/cayenne/sandbox/CocoaCayenne/CAYClient/AppController.m
    incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.h
    incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m
    incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.h
    incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.m
    incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.h
    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=433363&r1=433362&r2=433363&view=diff
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/AppController.m (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/AppController.m Mon Aug 21 14:17:07 2006
@@ -70,12 +70,25 @@
         // hessianClassName entry
 		if(![entityName isEqualToString:@"hessianClassName"])
 		{
-			NSLog(@"found entitya %@", entityName);
+			NSLog(@"found entity %@", entityName);
 			CAYObjEntity *entity = [objEntityMap objectForKey:entityName];
-			NSLog(@"mapping client %@ to server %@", [entity valueForKey:@"name"], [entity valueForKey:@"className"]);
+            
+            Class cl = NSClassFromString([entity name]);
+            if(cl)
+            {
+                NSLog(@"mapping client %@ to server %@", [entity name], [entity serverClassName]);
+            	[classMapping setObject:[entity name] forKey:[entity serverClassName]];
+            }
+            else
+            {
+                NSLog(@"Could not find cocoa class %@ for server class $@", [entity name],
[entity serverClassName]);
+            }
 		}
 	}
-	
+    
+    // update class mapping
+    // TODO: is this needed?
+	[BBSHessianProxy setClassMapping:classMapping];
 		
 	CAYNamedQuery *query = [[CAYNamedQuery alloc] init];
 	[query setName:@"objcquery"];

Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.h
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.h?rev=433363&r1=433362&r2=433363&view=diff
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.h (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.h Mon Aug 21 14:17:07 2006
@@ -11,6 +11,14 @@
 
 @interface Artist : CAYPersistentObject {
 
+	NSString *name;
+    NSDate *dateOfBirth;
+
 }
+
+-(void)setName:(NSString *)n;
+-(NSString *)name;
+-(void)setDateOfBirth:(NSDate *)d;
+-(NSDate *)dateOfBirth;
 
 @end

Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m?rev=433363&r1=433362&r2=433363&view=diff
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/Artist.m Mon Aug 21 14:17:07 2006
@@ -11,4 +11,51 @@
 
 @implementation Artist
 
+-(id)initWithCoder:(NSCoder*)coder
+{
+	[super initWithCoder:coder];
+	[self setName:[coder decodeObjectForKey:@"name"]];
+	[self setDateOfBirth:[coder decodeObjectForKey:@"dateOfBirth"]];
+	return self;
+}
+
+-(void)encodeWithCoder:(NSCoder*)coder
+{
+    [super encodeWithCoder:coder];
+	[coder encodeObject:name forKey:@"name"];
+	[coder encodeObject:dateOfBirth forKey:@"dateOfBirth"];
+}
+
+-(void)setName:(NSString *)n
+{
+	[n retain];
+	[name release];
+	name = n;
+}
+
+-(NSString *)name
+{
+	return name;
+}
+
+-(void)setDateOfBirth:(NSDate *)d
+{
+    [d retain];
+    [dateOfBirth release];
+    dateOfBirth = d;
+}
+
+-(NSDate *)dateOfBirth
+{
+    return dateOfBirth;
+}
+
+-(void)dealloc
+{
+	[name release];
+    [dateOfBirth release];
+	[super dealloc];
+}
+
+
 @end

Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.h
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.h?rev=433363&r1=433362&r2=433363&view=diff
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.h (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.h Mon Aug 21 14:17:07 2006
@@ -13,6 +13,7 @@
 
 	NSArray *attributes;
 	NSString *name;
+    NSString *serverClassName;
 	NSDictionary *relationships;
 	
 }
@@ -21,6 +22,8 @@
 -(NSArray *)attributes;
 -(void)setName:(NSString *)n;
 -(NSString *)name;
+-(void)setServerClassName:(NSString *)n;
+-(NSString *)serverClassName;
 -(void)setRelationships:(NSDictionary *)r;
 -(NSDictionary *)relationships;
 

Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.m
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.m?rev=433363&r1=433362&r2=433363&view=diff
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.m (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYObjEntity.m Mon Aug 21 14:17:07 2006
@@ -16,6 +16,7 @@
 	[super init];
 	[self setAttributes:[coder decodeObjectForKey:@"attributes"]];
 	[self setName:[coder decodeObjectForKey:@"name"]];
+	[self setServerClassName:[coder decodeObjectForKey:@"className"]];
 	[self setRelationships:[coder decodeObjectForKey:@"relationships"]];
 	return self;
 }
@@ -24,6 +25,7 @@
 {
 	[coder encodeObject:attributes forKey:@"attributes"];
 	[coder encodeObject:name forKey:@"name"];
+	[coder encodeObject:serverClassName forKey:@"className"];
 	[coder encodeObject:relationships forKey:@"relationships"];
 }
 
@@ -51,6 +53,18 @@
 	return name;
 }
 
+-(void)setServerClassName:(NSString *)n
+{
+	[n retain];
+	[serverClassName release];
+	serverClassName = n;
+}
+
+-(NSString *)serverClassName
+{
+	return serverClassName;
+}
+
 -(void)setRelationships:(NSDictionary *)r
 {
 	[r retain];
@@ -68,6 +82,7 @@
 	[attributes release];
 	[name release];
 	[relationships release];
+    [serverClassName release];
 	[super dealloc];
 }
 

Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.h
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.h?rev=433363&r1=433362&r2=433363&view=diff
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.h (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.h Mon Aug 21 14:17:07
2006
@@ -10,7 +10,7 @@
 #import "CAYObjectId.h"
 #import "CAYObjectContext.h"
 
-@interface CAYPersistentObject : NSObject {
+@interface CAYPersistentObject : NSObject <NSCoding> {
 	CAYObjectId *objectId;
 	unsigned int persistenceState;
 	id objectContext;

Modified: incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m
URL: http://svn.apache.org/viewvc/incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m?rev=433363&r1=433362&r2=433363&view=diff
==============================================================================
--- incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m (original)
+++ incubator/cayenne/sandbox/CocoaCayenne/CAYClient/CAYPersistentObject.m Mon Aug 21 14:17:07
2006
@@ -13,6 +13,18 @@
 
 @implementation CAYPersistentObject
 
+-(id)initWithCoder:(NSCoder*)coder
+{
+	[super init];
+	[self setObjectId:[coder decodeObjectForKey:@"objectId"]];
+	return self;
+}
+
+-(void)encodeWithCoder:(NSCoder*)coder
+{
+	[coder encodeObject:objectId forKey:@"objectId"];
+}
+
 -(void)setObjectId:(CAYObjectId *)oid
 {
 	[oid retain];



Mime
View raw message