mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Ported RestKit to using managed object contexts with concurrency types. Numerous cleanups and API updates.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
|
||||
#import "RKAbstractTableController.h"
|
||||
#import "RKAbstractTableController_Internals.h"
|
||||
#import "RKObjectMappingOperation.h"
|
||||
#import "RKMappingOperation.h"
|
||||
#import "RKLog.h"
|
||||
#import "RKErrors.h"
|
||||
#import "RKReachabilityObserver.h"
|
||||
@@ -475,7 +475,7 @@ static NSString *lastUpdatedDateDictionaryKey = @"lastUpdatedDateDictionaryKey";
|
||||
NSAssert(cell, @"Cell mapping failed to dequeue or allocate a tableViewCell for object: %@", mappableObject);
|
||||
|
||||
// Map the object state into the cell
|
||||
RKObjectMappingOperation* mappingOperation = [[RKObjectMappingOperation alloc] initWithSourceObject:mappableObject destinationObject:cell mapping:cellMapping];
|
||||
RKMappingOperation* mappingOperation = [[RKMappingOperation alloc] initWithSourceObject:mappableObject destinationObject:cell mapping:cellMapping];
|
||||
NSError* error = nil;
|
||||
BOOL success = [mappingOperation performMapping:&error];
|
||||
[mappingOperation release];
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
#import "RKFetchedResultsTableController.h"
|
||||
#import "RKAbstractTableController_Internals.h"
|
||||
#import "RKManagedObjectStore.h"
|
||||
#import "NSManagedObject+ActiveRecord.h"
|
||||
#import "RKObjectMappingOperation.h"
|
||||
#import "RKMappingOperation.h"
|
||||
#import "RKEntityMapping.h"
|
||||
#import "RKLog.h"
|
||||
#import "RKObjectMappingProvider+CoreData.h"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#import "RKFormSection.h"
|
||||
#import "RKTableViewCellMapping.h"
|
||||
#import "RKTableController.h"
|
||||
#import "RKObjectMappingOperation.h"
|
||||
#import "RKMappingOperation.h"
|
||||
#import "RKLog.h"
|
||||
|
||||
// Set Logging Component
|
||||
@@ -213,7 +213,7 @@
|
||||
RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[self.object class]];
|
||||
NSMutableDictionary *controlValues = [NSMutableDictionary dictionaryWithCapacity:[self.tableItems count]];
|
||||
for (RKTableItem *tableItem in self.tableItems) {
|
||||
RKObjectAttributeMapping *controlMapping = [tableItem.userData objectForKey:@"__RestKit__attributeToControlMapping"];
|
||||
RKAttributeMapping *controlMapping = [tableItem.userData objectForKey:@"__RestKit__attributeToControlMapping"];
|
||||
if (controlMapping) {
|
||||
id controlValue = nil;
|
||||
NSString *attributeKeyPath = attributeKeyPath = [controlMapping.sourceKeyPath stringByReplacingOccurrencesOfString:@"userData.__RestKit__object." withString:@""];
|
||||
@@ -248,7 +248,7 @@
|
||||
|
||||
RKLogTrace(@"Object mapping form state into target object '%@' with values: %@", self.object, controlValues);
|
||||
objectMapping.performKeyValueValidation = NO; // TODO: Temporary...
|
||||
RKObjectMappingOperation *operation = [RKObjectMappingOperation mappingOperationFromObject:controlValues toObject:self.object withMapping:objectMapping];
|
||||
RKMappingOperation *operation = [RKMappingOperation mappingOperationFromObject:controlValues toObject:self.object withMapping:objectMapping];
|
||||
NSError *error = nil;
|
||||
BOOL success = [operation performMapping:&error];
|
||||
if (!success) {
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)addAttributeMapping:(RKObjectAttributeMapping *)attributeMapping forKeyPath:(NSString *)attributeKeyPath toTableItem:(RKTableItem *)tableItem
|
||||
- (void)addAttributeMapping:(RKAttributeMapping *)attributeMapping forKeyPath:(NSString *)attributeKeyPath toTableItem:(RKTableItem *)tableItem
|
||||
{
|
||||
[tableItem.cellMapping addAttributeMapping:attributeMapping];
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
|
||||
- (void)addMappingFromAttribute:(NSString *)attributeKeyPath toKeyPath:(NSString *)keyPath forTableItem:(RKTableItem *)tableItem
|
||||
{
|
||||
RKObjectAttributeMapping *attributeMapping = [[RKObjectAttributeMapping new] autorelease];
|
||||
RKAttributeMapping *attributeMapping = [[RKAttributeMapping new] autorelease];
|
||||
attributeMapping.sourceKeyPath = [NSString stringWithFormat:@"userData.__RestKit__object.%@", attributeKeyPath];
|
||||
attributeMapping.destinationKeyPath = keyPath;
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
- (void)addRowMappingAttribute:(NSString *)attributeKeyPath toKeyPath:(NSString *)controlKeyPath onControl:(UIControl *)control usingBlock:(void (^)(RKControlTableItem *tableItem))block {
|
||||
RKControlTableItem *tableItem = [RKControlTableItem tableItemWithControl:control];
|
||||
RKObjectAttributeMapping *attributeMapping = [[RKObjectAttributeMapping new] autorelease];
|
||||
RKAttributeMapping *attributeMapping = [[RKAttributeMapping new] autorelease];
|
||||
attributeMapping.sourceKeyPath = [NSString stringWithFormat:@"userData.__RestKit__object.%@", attributeKeyPath];
|
||||
attributeMapping.destinationKeyPath = [NSString stringWithFormat:@"control.%@", controlKeyPath];
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
{
|
||||
RKTableItem *tableItem = [RKTableItem tableItem];
|
||||
tableItem.cellMapping.cellClass = cellClass;
|
||||
RKObjectAttributeMapping *attributeMapping = [[RKObjectAttributeMapping new] autorelease];
|
||||
RKAttributeMapping *attributeMapping = [[RKAttributeMapping new] autorelease];
|
||||
attributeMapping.sourceKeyPath = [NSString stringWithFormat:@"userData.__RestKit__object.%@", attributeKeyPath];
|
||||
attributeMapping.destinationKeyPath = cellKeyPath;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#import "RKLog.h"
|
||||
#import "RKFormSection.h"
|
||||
#import "NSArray+RKAdditions.h"
|
||||
#import "RKObjectMappingOperation.h"
|
||||
#import "RKMappingOperation.h"
|
||||
|
||||
// Define logging component
|
||||
#undef RKLogComponent
|
||||
|
||||
Reference in New Issue
Block a user