25#import "CoreDataHeaders.h"
26#import "GSPersistentStore.h"
28@interface NSManagedObjectID (GSCoreDataInternal)
30+ (void) willBecomeMultiThreaded: (NSNotification *) notif;
38@implementation NSManagedObjectID
42 if (
self == [NSManagedObjectID
class])
44 [[NSNotificationCenter defaultCenter]
46 selector: @selector(willBecomeMultiThreaded:)
47 name: NSWillBecomeMultiThreadedNotification
54 TEST_RELEASE(_persistentStore);
55 TEST_RELEASE(_entity);
76 return (_persistentStore == nil);
85 return _persistentStore;
95 if (_persistentStore == nil)
102 objectForKey: NSStoreUUIDKey];
105 @"%@/%@/%llX", UUID, [
_entity name], _value]];
118 if ([_entity isEqual: [otherID entity]] == NO)
123 if ([
self isTemporaryID] != [otherID isTemporaryID])
128 if (_persistentStore != [otherID persistentStore])
139- (BOOL) isEqual: (
id) otherObject
141 if ([otherObject isKindOfClass: [NSManagedObjectID
class]])
143 return [
self isEqualToManagedObjectID: otherObject];
153- (id) copyWithZone: (NSZone *) zone
156 _initWithEntity: _entity
157 persistentStore: _persistentStore
163@implementation NSManagedObjectID (GSCoreDataPrivate)
171static unsigned long long nextTemporaryID = 0;
176static NSRecursiveLock * lock = nil;
178- (id) _initWithEntity: (NSEntityDescription *) entity
180 if ((
self = [super init]))
182 ASSIGN(_entity, entity);
189 _value = nextTemporaryID;
196 _value = nextTemporaryID;
203- (id) _initWithEntity: (NSEntityDescription *) entity
204 persistentStore: (GSPersistentStore *) persistentStore
205 value: (
unsigned long long) value
207 if ((
self = [super init]))
209 ASSIGN(_entity, entity);
210 ASSIGN(_persistentStore, persistentStore);
217- (
unsigned long long) _value
224@implementation NSManagedObjectID (GSCoreDataInternal)
231+ (void) willBecomeMultiThreaded: (NSNotification *) notif
233 lock = [NSRecursiveLock new];
235 [[NSNotificationCenter defaultCenter] removeObserver:
self];
Nn abstract superclass from which concrete implementations of various persistent store types are subc...
NSDictionary * metadata()
Returns the store's metadata.
For implementation notes see "Documentation/NSManagedObjectID.txt" in the source distribution of the ...
BOOL isTemporaryID()
Returns NO if the receiver is a permanent ID (that is, it has been already saved to or fetched from a...
id persistentStore()
Returns the persistent store from which the receiver has been fetched or to which it has been stored,...
NSURL * URIRepresentation()
Returns an archivable URI representation of the receiver.
NSEntityDescription * entity()
Returns the receiver's entity (that is, the entity of the object to which this managed object ID belo...