-
Notifications
You must be signed in to change notification settings - Fork 0
/
mmBusinessObject.h
65 lines (47 loc) · 2.37 KB
/
mmBusinessObject.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// mmBusinessObject.h
// mmiOS
//
// Created by Kevin McNeish on 12/18/12.
// Copyright 2013 Oak Leaf Enterprises, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface mmBusinessObject : NSObject {
NSManagedObjectContext *_managedObjectContext;
NSManagedObjectModel *_managedObjectModel;
NSPersistentStoreCoordinator *_persistentStoreCoordinator;
}
@property (nonatomic, copy) NSString* dbName;
@property (nonatomic, copy) NSString* entityClassName;
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
@property (readonly, nonatomic, retain) NSManagedObjectModel *managedObjectModel;
@property (readonly, nonatomic, retain) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property (nonatomic, assign) BOOL copyDatabaseIfNotPresent;
- (NSURL *)applicationDocumentsDirectory;
// Create a new entity of the default type
- (NSManagedObject *)createEntity;
// Mark the specified entity for deletion
- (void) deleteEntity:(NSManagedObject *)entity;
// Gets all entities of the default type
- (NSMutableArray *)getAllEntities;
// Gets entities of the default type matching the predicate
- (NSMutableArray *)getEntitiesMatchingPredicate: (NSPredicate *)predicate;
// Gets entities of the default type matching the predicate string
- (NSMutableArray *)getEntitiesMatchingPredicateString: (NSString *)predicateString, ...;
// Get entities of the default type sorted by descriptor matching the predicate
- (NSMutableArray *)getEntitiesSortedBy: (NSSortDescriptor *) sortDescriptor
matchingPredicate:(NSPredicate *)predicate;
// Get entities of the specified type sorted by descriptor matching the predicate
- (NSMutableArray *)getEntities: (NSString *)entityName sortedBy:
(NSSortDescriptor *)sortDescriptor matchingPredicate:(NSPredicate *)predicate;
// Get entities of the specified type sorted by descriptor matching the predicate string
- (NSMutableArray *)getEntities: (NSString *)entityName sortedBy:
(NSSortDescriptor *)sortDescriptor matchingPredicateString:(NSString *)predicateString, ...;
// Saves changes to all entities managed by the object context
- (void)saveEntities;
// Register a related business controller object
// This causes them to use the same object context
- (void)registerRelatedObject:(mmBusinessObject *)controllerObject;
- (void)performAutomaticLightweightMigration;
@end