preserving object relationships during cut & paste
preserving object relationships during cut & paste
- Subject: preserving object relationships during cut & paste
- From: Todd Ransom <email@hidden>
- Date: Sat, 7 May 2005 19:26:54 -0600
Long, long ago...
I posted a message to this list asking for help with designing many-to-many relationships in my Cocoa app. Several people responded with helpful suggestions and I ended up taking mmalc's advice to keep an array in each object of the objects it was related to. You can see the original thread here:
http://www.cocoabuilder.com/archive/message/cocoa/2004/6/18/110023
One of the things mentioned at the time was:
"
<x-tad-bigger>If you deal with multiple graphs, then you do run the risk of data getting out of sync and it's likely you'll need to associate a "global ID" with each object to assure uniqueness."
But I thought "Bah! I don't need to do that. I'm only dealing with one object graph."
Well now I have implemented cut, copy & paste by archiving my data and putting it on the pasteboard. But when I paste the data back in I discover that all the relationships are broken because I have, indeed, created multiple graphs. I don't think it will be difficult to create unique IDs for each object but I am wondering if anyone knows of a nice way to re-create these relationships. The only thing I can think of is a brute-force approach: iterating the data arrays looking for existing objects with matching UUIDs.
</x-tad-bigger>thanks,
Todd Ransom
Return Self Software
http://returnself.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden