JPDBManager Class Reference

Database Manager are one Facade around Core Data classes that facilitate the main operations around the Core Data Framework. More...

#import <JPDBManager.h>

Inheritance diagram for JPDBManager:

List of all members.

Properties

NSManagedObjectModel * managedObjectModel
 Core Data Managed Object Model.
NSManagedObjectContext * managedObjectContext
 Core Data Managed Object Context.
NSPersistentStoreCoordinator * persistentStoreCoordinator
 Core Data Persistent Store Coordinator.
NSString * loadedModelName
 Current full path of Loaded Model.
BOOL automaticallyCommit
 Configure the manager to automatically commit every operation.

Init Methods

(id) + init
 Init and Alloc the Database Manager Class.
(id) + initAndStartCoreData
 Init and Alloc the Database Manager Class.

Start and Stop Methods

(id) - startCoreData
 Start Core Data elements (managedObjectModel, managedObjectContext, persistentStoreCoordinator) and will merge ALL models in your bundle.
(id) - startCoreDataWithModel:
 Start Core Data elements (managedObjectModel, managedObjectContext, persistentStoreCoordinator).
(void) - closeCoreData
 Close Core Data Databases, commit pendent updates and release resources.

Get Info Methods

(BOOL) - existEntity:
 Test if specified Entity exist on the model.
(BOOL) - existAttribute:inEntity:
 Test if specified Attribute exist on specified Entity.
(JPDBManagerAction *) - getDatabaseAction
 Helper method to retrieve an Database Action object.

Write Data Methods

(void) - commit
 Commit al pendent operations to the persistent store.

Detailed Description

Database Manager are one Facade around Core Data classes that facilitate the main operations around the Core Data Framework.

See the Basic Uses to learn the basic concepts about this class. Also consult Handling Errors and Performing Queries.


Member Function Documentation

+ (id) init

Init and Alloc the Database Manager Class.

Returns:
One autoreleseable instance.

Here is the caller graph for this function:

+ (id) initAndStartCoreData

Init and Alloc the Database Manager Class.

Automatically Start all Core Data Engine.

Returns:
One autoreleseable instance.

Here is the call graph for this function:

- (id) startCoreData

Start Core Data elements (managedObjectModel, managedObjectContext, persistentStoreCoordinator) and will merge ALL models in your bundle.


Database Manager initiate the Managed Object Context and set the Merge Policy to NSMergeByPropertyObjectTrumpMergePolicy in order to merge conflicts between the persistent store’s version of the object and the current in-memory version, giving priority to in-memory changes.

Use startCoreDataWithModel: if you need to use an specific model or model version.

Exceptions:
AnJPDBManagerStartException exception is raised if some error ocurrs. See Handling Errors for more informations.
Returns:
Return itself.

Here is the caller graph for this function:

- (id) startCoreDataWithModel: (NSString*)  modelName

Start Core Data elements (managedObjectModel, managedObjectContext, persistentStoreCoordinator).

Database Manager initiate the Managed Object Context and set the Merge Policy to NSMergeByPropertyObjectTrumpMergePolicy in order to merge conflicts between the persistent store’s version of the object and the current in-memory version, giving priority to in-memory changes.
You should inform the Model that you want to use with name and extension.

Parameters:
modelNameSpecific Model Name including the extension. Usually the model has the extension .momd on the bundle.
Exceptions:
AnJPDBManagerStartException exception is raised if some error ocurrs. See Handling Errors for more informations.
Returns:
Return itself.

Here is the call graph for this function:

- (BOOL) existEntity: (NSString*)  anEntityName

Test if specified Entity exist on the model.

Parameters:
anEntityNameThe Entity Name.
Returns:
YES if specified Entity exist on the model.
- (BOOL) existAttribute: (NSString*)  anAttributeName
inEntity: (NSString*)  anEntityName 

Test if specified Attribute exist on specified Entity.

Parameters:
anAttributeNameThe Attribute name.
anEntityNameThe Entity name.
Returns:
YES if specified Attribute exist on specified Entity.
- (JPDBManagerAction *) getDatabaseAction

Helper method to retrieve an Database Action object.

The manager is automatically associcated to this object.

Here is the call graph for this function:


Property Documentation

- (NSString *) loadedModelName [read, assign]

Current full path of Loaded Model.

If you don't specify one model manually using startCoreDataWithModel: this value will be nil.

- (BOOL) automaticallyCommit [read, write, assign]

Configure the manager to automatically commit every operation.

Default value is NO. See Basic Uses for more information.


The documentation for this class was generated from the following files: