GNUstep Core Data
0.1
|
Private methods of GNUstep Core Data for NSManagedObjectContext. More...
Public Member Functions | |
(NSPersistentStoreCoordinator *) | - persistentStoreCoordinator |
Returns the persistent store coordinator associated with the receiver. | |
(void) | - setPersistentStoreCoordinator: |
Sets the persistent store coordinator of the receiver. | |
(NSUndoManager *) | - undoManager |
Returns the current undo manager of the receiver. | |
(void) | - setUndoManager: |
Sets a new undo manager in the receiver. | |
(void) | - undo |
Sends `-undo' to the receiver's undo manager. | |
(void) | - redo |
Sends `-redo' to the receiver's undo manager. | |
(void) | - reset |
Resets the receiver. | |
(BOOL) | - save: |
Saves all changed objects in the receiver to the persistent store. | |
(BOOL) | - hasChanges |
Queries whether the receiver has some unsaved changes. | |
(NSManagedObject *) | - objectRegisteredForID: |
Returns the object registered in the receiver with object ID `objectID', or `nil' if an object of the specified ID isn't registered in the receiver. | |
(NSManagedObject *) | - objectWithID: |
Attempts to locate an object registered in the receiver with an object ID of `objectID'. | |
(NSArray *) | - executeFetchRequest:error: |
Retrieves all objects from the receiver and it's associated stores which match the provided fetch request. | |
(void) | - insertObject: |
Inserts the `object' into the receiver. | |
(void) | - deleteObject: |
Schedules the `object' for deletion from the persistent store of the receiver. | |
(void) | - assignObject:toPersistentStore: |
Assigns an newly inserted object to be stored in a particular persistent store. | |
(void) | - refreshObject:mergeChanges: |
Refreshes an object's persistent properties with data from the persistent store, possibly overwriting changed values. | |
(NSSet *) | - insertedObjects |
Returns a set of object which will be inserted into the persistent store at the next save operation. | |
(NSSet *) | - updatedObjects |
Returns a set of object which have changed since the last successful save operation. | |
(NSSet *) | - deletedObjects |
Returns a set of object which will be removed from the persistent store at the next save operation. | |
(NSSet *) | - registeredObjects |
Returns a set containing all objects registered with the receiver. | |
(void) | - lock |
Attempts to lock the receiver, blocking if the lock is already taken. | |
(void) | - unlock |
Unlocks the receiver. | |
(BOOL) | - tryLock |
Attempts to acquire the lock, but never blocks, even if the lock is already taken. | |
(BOOL) | - retainsRegisteredObjects |
Returns whether the receiver retains objects which are registered with it. | |
(void) | - setRetainsRegisteredObjects: |
Sets whether the receiver retains objects which are registered with it or not. | |
(NSTimeInterval) | - stalenessInterval |
Returns the staleness interval of the receiver. | |
(void) | - setStalenessInterval: |
Sets the staleness interval of the receiver. | |
(id) | - mergePolicy |
Returns the merge policy of the receiver. | |
(void) | - setMergePolicy: |
Sets the merge policy of the receiver. |
Private methods of GNUstep Core Data for NSManagedObjectContext.
Internal methods methods of GNUstep Core Data for NSManagedObjectContext.
Do NOT invoke these from external code!
Definition at line 43 of file NSManagedObjectContext.h.
- (void) assignObject: | (id) | anObject | |
toPersistentStore: | (id) | aPersistentStore | |
Assigns an newly inserted object to be stored in a particular persistent store.
anObject | The object to be assigned to the persitent store. It must be an NSManagedObject which has been newly inserted into the receiver - reassigning already saved objects isn't possible. |
aPersistentStore | The persistent store to which to assign the object. It must be a persistent store from the persistent stores of the persistent store coordinator associated with the receiver, otherwise an NSInvalidArgumentException is raised. |
Definition at line 656 of file NSManagedObjectContext.m.
- (void) deleteObject: | (NSManagedObject *) | object |
Schedules the `object' for deletion from the persistent store of the receiver.
The next time the receiver is saved, the object will be permanently removed from the persistent store.
Definition at line 609 of file NSManagedObjectContext.m.
- (NSArray *) executeFetchRequest: | (NSFetchRequest *) | request | |
error: | (NSError **) | error | |
Retrieves all objects from the receiver and it's associated stores which match the provided fetch request.
N.B. objects are first looked for in the receiver and only after that will the stores be consulted. That means that any objects which were already brought into memory, even those that have changed since then or have been altered in the persistent store by another context, will be retrieved before any object from a persistent store. Please also keep in mind the fact that the staleness interval is again consulted by the store coordinator upon issuing a new fetch to determine whether it can use cached data or has whether it has to make a full round-trip to the persistent store(s).
request | The fetch request which to execute. |
error | A pointer to an error object where errors during fetching of objects will be aggreggated. |
Definition at line 502 of file NSManagedObjectContext.m.
- (BOOL) hasChanges |
Queries whether the receiver has some unsaved changes.
Changes are objects being changed, inserted or removed.
Definition at line 424 of file NSManagedObjectContext.m.
- (void) insertObject: | (NSManagedObject *) | object |
Inserts the `object' into the receiver.
The next time the receiver is saved it will be written into the persistent store. Upon inserting the object, an NSManagedObjectContextObjectsDidChangeNotification is posted to the default notification center with the NSInsertedObjectsKey bound to a set containing the inserted object in the user info dictionary.
Definition at line 568 of file NSManagedObjectContext.m.
- (void) lock |
Attempts to lock the receiver, blocking if the lock is already taken.
Definition at line 802 of file NSManagedObjectContext.m.
- (id) mergePolicy |
Returns the merge policy of the receiver.
Definition at line 901 of file NSManagedObjectContext.m.
- (NSManagedObject *) objectWithID: | (NSManagedObjectID *) | objectID |
Attempts to locate an object registered in the receiver with an object ID of `objectID'.
If the object exists, it is returned. If it doesn't, it is created as a fault and returned. The object is assumed to exist in the associated persistent store. If it doesn't, the time the fault is fired, an NSInternalInconsistencyException is raised.
Definition at line 461 of file NSManagedObjectContext.m.
- (void) refreshObject: | (NSManagedObject *) | object | |
mergeChanges: | (BOOL) | mergeChanges | |
Refreshes an object's persistent properties with data from the persistent store, possibly overwriting changed values.
In case the object's data don't exist in the persistent store, an NSInvalidArgumentException is raised. In case the persistent store coordinator has cached data for this object (and the staleness) interval hasn't been exceeded, no new fetch will be issued.
object | The object to be refreshed. |
mergeChanges | If this argument is YES, then after all persistent properties of the object have been sync'ed with the values in the persistent store, any previously changed values of the object are re-applied over the refreshed object. Also, any transient properties are left untouched. If this argument is NO, then any changes made to the object aren't re-applied and transient properties are released. |
Definition at line 737 of file NSManagedObjectContext.m.
- (void) reset |
Resets the receiver.
This in particular means:
Definition at line 280 of file NSManagedObjectContext.m.
- (BOOL) retainsRegisteredObjects |
Returns whether the receiver retains objects which are registered with it.
By default a managed object context does not retain it's registered objects.
Definition at line 841 of file NSManagedObjectContext.m.
- (BOOL) save: | (NSError **) | errorPtr |
Saves all changed objects in the receiver to the persistent store.
The save is carried out by first consulting the receiver's merge policy to resolve potential conflicts between the version of the objects in the receiver and the versions in the persistent store.
errorPtr | A pointer to a location which will be set to point to an error object in case an error arises during saving. |
Definition at line 312 of file NSManagedObjectContext.m.
- (void) setMergePolicy: | (id) | policy |
Sets the merge policy of the receiver.
The merge policy defines how conflicts during save operations are handled. The default policy of newly created managed object contexts is NSErrorMergePolicy.
policy | Identifies the merge policy to use. The value must be one of: |
As an extension, GNUstep Core Data allows you to pass even your custom subclass of GSMergePolicy, since all merge policies are implemented as subclasses of it.
Definition at line 924 of file NSManagedObjectContext.m.
- (void) setPersistentStoreCoordinator: | (NSPersistentStoreCoordinator *) | coordinator |
Sets the persistent store coordinator of the receiver.
A managed object context isn't fully functional until it is connected to a persistent store coordinator.
coordinator | The persistent store coordinator to use. |
Definition at line 198 of file NSManagedObjectContext.m.
- (void) setRetainsRegisteredObjects: | (BOOL) | flag |
Sets whether the receiver retains objects which are registered with it or not.
By default, a managed object context does not retain it's registered objects.
Object's scheduled for addition, deletion or have changed are always retained.
Definition at line 854 of file NSManagedObjectContext.m.
- (void) setStalenessInterval: | (NSTimeInterval) | timeInterval |
Sets the staleness interval of the receiver.
The staleness interval determines when fetches are being done whether any cached data is reused or a new fetch is issued.
timeInterval | The new staleness interval. Passing zero means infinite staleness interval. |
Definition at line 891 of file NSManagedObjectContext.m.
- (void) setUndoManager: | (NSUndoManager *) | aManager |
Sets a new undo manager in the receiver.
aManager | The undo manager to use. |
Definition at line 217 of file NSManagedObjectContext.m.
- (NSTimeInterval) stalenessInterval |
Returns the staleness interval of the receiver.
Definition at line 878 of file NSManagedObjectContext.m.
- (BOOL) tryLock |
Attempts to acquire the lock, but never blocks, even if the lock is already taken.
Definition at line 828 of file NSManagedObjectContext.m.
- (void) unlock |
Unlocks the receiver.
Definition at line 813 of file NSManagedObjectContext.m.