Commit Graph

70 Commits

Author SHA1 Message Date
Blake Watters
de5aed6bde Fix incorrect type transformation when the destination class is a mutable class. fixes #1201 2013-03-09 23:03:06 -05:00
Charlie Savage
535255a686 Fix RKReplaceAssignmentPolicy. The problem was that new values for the relationship were gathered before the old values were deleted. Therefore if one of the new values was the same as the old value, the valueForRelationship collection would contain a deleted managed - not good.
Also fixed:
* The if statement near line 674 was incorrectly negated
 * Setting the relationship value around line 676 was redundant since it was done in the mapCoreDataToManyRelationshipValue:withMapping method.
2013-03-07 20:55:42 -05:00
Christian Himmelsbach
4c1d010e91 fix: To one relationships, that have a nested destination keypath are not correctly mapped to JSON 2013-03-07 14:55:07 -05:00
Blake Watters
197a54bf60 Rework metadata mapping to fix breakage under OS X 2013-02-01 11:26:08 -05:00
Jeff Arena
2f78250891 Change log level for a specific mapping operation failure case 2013-01-28 17:49:34 -05:00
Blake Watters
4840b4b63e Fix crash when attempting to union a relationship with a nil value. fixes #1195 2013-01-28 17:22:33 -05:00
Blake Watters
d761de0ea7 Fix crash when attempting to map nil sourceKeyPath as identification attribute 2013-01-26 00:21:44 -05:00
Blake Watters
4c39918fdb Implement support for flexible metdata mapping. closes #582, #688
* Metadata mapping is implemented via an `NSProxy` object that stands in for the `sourceObject` of each `RKMappingOperation`
* Key paths that are prefixed with `@metadata.` are mapped against the `metadata` dictionary of the operation, else they hit the `sourceObject`.
* Metadata is implemented by merging a dictionary of data in from `RKObjectRequestOperation`, through to `RKResponseMapperOperation`, into `RKMapperOperation`, and all the way down into the `RKMappingOperation`, where it is available to each object. By convention, metdata is namespaced into subdictionaries.
2013-01-24 16:31:19 -05:00
Blake Watters
966e006990 Fix bug with refetching due to failure to track applied attribute mapping when mapped value is unchanged. closes #1176 2013-01-21 15:03:53 -05:00
Blake Watters
06f2fe9c7b Radically simplify the implementation of managed object deletion and refetching within RKManagedObjectRequestOperation. closes #1163
1. Eliminates use of visitor in favor of aggregating mapping info during mapping. This avoids having to traverse the mapping graph.
1. Eliminate special case handling of cyclic key paths.
1. Eliminate issues with infinite recursion while traversing the mapping graph.
2013-01-18 12:20:51 -05:00
Blake Watters
a65a50e8f7 Fix bug with mapping nested attribute values with identification attributes when the identification attribute is not the nesting key. fixes #1129 2013-01-17 11:34:40 -05:00
James Moschou
02952aa2bb Add support for transforming strings 'Y' and 'N' to boolean NSNumber objects 2013-01-16 19:26:04 -05:00
Blake Watters
868d83be2c Don't create unnecessary objects when mapping temporary managed objects POST'd without identification attributes. closes #1149 2013-01-15 22:45:43 -05:00
Blake Watters
139decbc36 Remove accidentally committed debug logging 2013-01-09 22:29:26 -05:00
Blake Watters
b61039c838 Use a visitor to identify all NSManagedObject instances being sent via the object manager which have a temporary managed object ID to avoid crashes during mapping. refs #1001 2013-01-09 21:11:38 -05:00
Blake Watters
422768f6b1 Add support for dynamic nesting key serialization. closes #684 2013-01-03 23:02:49 -05:00
Blake Watters
9005bd573c Add test coverage and fixes for RKMappingTest. closes #1086 2013-01-03 18:19:50 -05:00
Blake Watters
a03191c291 Add support for skipping an aggregate relationship mapping in the event that the parent representation does not contain any values for the property mappings of the concrete RKObjectMapping configured for the relationship. fixes #1114, closes #1115 2012-12-31 17:33:41 -05:00
Blake Watters
b23ea410a8 Add support and test for inversing a mapping containing attributes mapped with nil destination key paths. fixes #1116 2012-12-29 22:13:12 -05:00
Blake Watters
92458a1e88 Enable support for mapping a relationship flexibly via assignment policies. You can now map a relationship and assign its value by setting, replacing, or unioning (combining) the relationship. closes #1073, closes #989 2012-12-26 17:56:39 -05:00
Blake Watters
b858f2753f Grow up support for mapping to primitives by avoiding crashes due to null conversions. fixes #1043, fixes #741, fixes #703 2012-12-26 14:40:59 -05:00
Blake Watters
d1568cad63 Add support for mapping singular values to collections. fixes #1046 2012-12-26 00:20:56 -05:00
Blake Watters
b3899ac191 Add support for mapping a relationship directly from the parent object representation, rather than at a nested key path. closes #859
* Update documentation in RKRelationshipMapping.h
2012-12-24 16:18:39 -05:00
Blake Watters
862e84a515 Hook the RKManagedObjectMappingOperationDataSource into the Managed Object Context save lifecycle to avoid the creation of duplicate objects during sequential mapping operations 2012-12-18 22:00:44 -05:00
Blake Watters
648b159f9a Remove dead code 2012-11-29 23:35:37 -05:00
Blake Watters
8dc54a89b2 Major overhaul to the Core Data managed object identification and relationship connection support.
* Replaces primary key with `RKEntityIdentifier`
* Add support for use of compound keys for object identification
* Refactor `RKConnectionMapping` to `RKConnectionDescription` and add support for connecting with multiple attributes
* Clarify naming of representation key methods to better match naming conventions
* Add type transformation support for object identification
* Greatly expand test coverage for object identification
* Drop the `NSEntityDescription` category
* Simplify the `RKManagedObjectCaching` protocol
* Add compound key support to the Fetch Request and In Memory Cache implementations
* Replace Kiwi with Specta for tests where contexts are helpful for organization
* Rename `defaultValueForMissingAttribute` to `defaultValueForAttribute`
2012-11-27 10:29:36 -05:00
Blake Watters
7888a55f6c Remove the ignoreUnknownKeyPaths option. closes #840 2012-11-19 19:21:24 -05:00
Blake Watters
7d9087b722 Supress extraneous logging when type is transformed to nil 2012-11-09 12:12:42 -05:00
Blake Watters
e109036683 Add support and test coverage for serializing Boolean properties to JSON as true/false instead of numbers. closes #920, #827 2012-11-08 23:41:19 -05:00
Blake Watters
3db5307f6a Add missing test coverage for key path based connection scenarios. Fixes crashes resulting from double collection wrapping during connection. 2012-11-08 19:31:38 -05:00
Blake Watters
d689ba9291 Add support for mapping to NSData attributes using a NSKeyedArchiver. closes #910 2012-11-07 11:00:15 -05:00
Blake Watters
454eb2e8fa Correct usage of 'method' instead of 'function' in comment 2012-10-28 19:40:22 -04:00
Blake Watters
117fcbb18c Fix horrible bugs in previous commit 2012-10-21 15:58:03 -04:00
Blake Watters
f93a044561 Add error condition when attempting to map an RKEntityMapping containing connection mappings with a nil managed object cache.
* Add support for the data source to fail mapping operation with an error.
* Clean up error handling within RKMappingOperation
2012-10-21 15:47:16 -04:00
Blake Watters
63c9a9e4a0 Fix bug in which relationship connection operations are not enqueued for RKMappingOperation instances whose mapping is an RKDynamicMapping 2012-10-20 16:53:14 -04:00
Blake Watters
08110ca300 Implement support for cancellation and prioritization of response mapping operations using an operation queue global to all object request operations.
* Passes through cancellation from object request operation to HTTP request operation and response mapping operation. closes #993
* Performs all object mapping within an NSOperationQueue to enable constraining of mapping activities.
* Add default mapping queue with concurrency limit of 1 operation.
* Migrate deserialization of the response body into a serial dispatch queue to ensure that only one parse occurs at a time.
2012-10-20 00:13:48 -04:00
Blake Watters
639897dd67 Refactored relationship mapping implementation to make it easier to follow and debug 2012-10-19 17:53:09 -04:00
Blake Watters
e748e5bfce Don't throw an exception if doing a simple attribute mapping with a nil data source. closes #1005 2012-10-18 15:17:57 -04:00
Blake Watters
e8b4cdd19c DRY up find or create of destination object within the mapping operation and change nil destination object to an error condition instead of an assertion. 2012-10-18 14:06:46 -04:00
Blake Watters
fb6db948e1 Implement support for using dynamic mapping during parameterization with a Request Descriptor. closes #684 2012-10-18 12:14:16 -04:00
Blake Watters
20c4121644 Improve logging when mapping a null relationship value. refs #862 2012-10-16 20:50:35 -04:00
Blake Watters
9d617c6c7b Add support for disconnecting relationships when mapping a related keypath whose value is equal to [NSNull null]. fixes #862 2012-10-16 20:48:27 -04:00
Jeff Arena
53f4105e57 Split out simple and keyPath attribute mappings to allow relationship mappings to run before keyPath mappings. 2012-10-16 18:07:36 -04:00
Blake Watters
64e9c7cb6d Add support for mapping attributes to deeply nested keyPaths on NSMutableDictionary. fixes #882 2012-10-15 22:00:14 -04:00
Blake Watters
74624200da Fix inappropriate override of start method in RKMappingOperation. This should be main, as we are not concurrent 2012-10-15 18:41:45 -04:00
Blake Watters
4a7ed3cbd3 Rename test files to align with classes 2012-10-14 13:51:39 -04:00
Blake Watters
877ce255b5 Expand test coverage and fix situations where requests would unexpectedly initialize incorrectly without error
* RKObjectParameterization now returns an empty dictionary if mapping produces an unmappable representation error (no mappable attributes/relationships found)
* Log errors if request construction results in an NSError and return nil
* Ensure errors are passed back up through object parameterization instead of just returning nil
* Reset the serialization MIME Type registry during RKTestFactory set up to ensure it is in a sane state
* Convert Hamcrest matchers to Expecta in the object mapper tests to fix infinite recursion on test failure (will need to completely phase out Hamcrest soon)
2012-10-05 19:16:55 -04:00
Blake Watters
d95fe5cd44 Break out reused functions for object mapping introspection into RKObjectUtilities 2012-09-30 12:49:59 -04:00
Blake Watters
ecb6af4776 Factor date formatting into reusable convenience functions 2012-09-28 14:59:57 -04:00
Arne Harren
bc7c65f03b Switch to an embedded variant of LibComponentLogging with prefix RK 2012-09-27 21:47:36 +02:00