Commit Graph

41 Commits

Author SHA1 Message Date
Brian Morton
0f3f3d5702 Add support for mapping an array to an NSOrderedSet. 2012-01-13 00:04:40 -08:00
Blake Watters
479864902b Fixed all build warnings on OS X Framework target 2011-12-08 23:23:20 -05:00
Blake Watters
6f68ffb342 Applied patch from Scott Penrose to handle issues with NSNull values mapped to Core Data properties. closes #436
Added RKLogWarning for aiding in further debugging. So far unable to trap this in a unit test, but have had
several complaints about the issue on the mailing list.
2011-12-02 09:27:23 -05:00
Blake Watters
563f5e909b Updated all example projects to build against the new project. Cleaned up header imports for flattened project structure 2011-12-02 09:26:36 -05:00
Blake Watters
5b718890ac Checking in work in progress on the library reorganization 2011-12-02 09:26:35 -05:00
Blake Watters
e1936103fd Check the type of destinationValue as well as sourceValue when determining the comparison selector to use. refs #343, refs #320
Hopefully this will fix the Core Data default attribute problem that I have been unable to recreate in unit tests.
2011-10-09 21:24:09 -04:00
Blake Watters
69e560d59c Fix for leaking object mapping queue references. fixes #390 2011-10-05 23:26:05 -04:00
Blake Watters
586034bae4 Add support for the use of nesting key attributes as the primaryKey in managed mappings.
This bug was causing duplication of objects in the store due to failed lookup of
existing objects. Added fix and test coverage for the use-case.
2011-10-05 10:50:52 -04:00
Blake Watters
a4d84aadf3 Use lastObject instead of objectAtIndex: to avoid exception during sanity check 2011-10-04 10:47:33 -04:00
Blake Watters
d94fcf665d Added sanity check that relationship mapping is not targeting a collection of collections. fixes #386
This can happen when using keyPaths to traverse an object graph and is hard to anticipate when
defining mappings. RestKit will now perform a sanity check before recursively performing
relationship object mapping operation and will log a warning if the relationship targets
a collection containing another collection. At the debug logging level, RestKit will log

The fix for such scenarios is to use KVC collection operators (such as @unionOfObjects,
@unionOfArrays, etc.) to flatten the collection out into a collection of dictionaries.
2011-10-01 11:52:51 -04:00
Blake Watters
144533cdd5 Renamed RKObjectDynamicMapping to RKDynamicObjectMapping to better mesh with Cocoa idioms. fixes #354
The old class name has been aliased for backwards compatibility.
2011-09-20 13:18:09 -04:00
Blake Watters
70c73f2981 Fixed issue with order dependence in Core Data connections. fixes #173
Since OM 2.0 connection of relationships happened during the object mapping operation
instead of aggregately at the end of the process. In this commit, we have introduced a lightweight
queue for deferring portions of the mapping operation until a larger aggregate mapping has completed.

The changes are as follows:
* Introduced RKMappingOperationQueue for queueing portions of mapping. This is a synchronous queue modeled off
of NSOperationQueue that does NOT use threading (for Core Data friendliness).
* RKObjectMappingOperation now has a RKMappingOperationQueue queue property that defaults to nil
* RKObjectMappingOperation instances built via RKObjectMapper will has a mapping operation queue
assigned to the property.
* If a queue is present, RKManagedObjectMappingOperation will use it to defer the connection of relationships.
* At the end of an RKObjectMapper process, the mapping operation queue used by all mapping operations created
during the process will be executed. This allows all relationships to be connected after all object creation
has completed.

The queue is general purpose, though currently only used for the connection of relationships.
2011-09-20 12:02:50 -04:00
Greg Combs
62d7042ebc Merge pull request #334 from parkerboundy/add-apache-license
Add the Apache License to headers (Issue #145) Closes #145.  Thanks @parkerboundy.
2011-09-14 21:56:15 -07:00
Björn Jonsson
90ef91e890 Fix of RKObjectMappingOperation does not respect forceCollectionMapping (Issue 341)
Includes test cases and fixtures
2011-09-14 22:50:03 +02:00
Parker
99250475ad added Apache License headers to all files in ObjectMapping directory 2011-09-07 11:31:01 -04:00
Blake Watters
54007c78d4 Reworked Brendan Ribera's contributions around time zone handling to eliminate the use of transient
NSDateFormatters, added a preferredDateFormatter for use when serializing dates to strings,
replaced the use of the description method for date encoding to strings with invocation of the
preferredDateFormatter, added new attribute transformation strategy from NSDate -> NSString properties
(also using the preferred date formatter), and provided customization support for date handling globally
and on a per-mapping basis. closes #200, closes #313, closes #309, closes #308
2011-09-05 17:25:43 -04:00
Jeff Arena
aceb75200a Fix for issues setting many-to-many relationships on NSManagedObjects, as well as some additional test coverage for the issue. fixes #271 2011-08-27 21:00:19 -04:00
Blake Watters
07830b5d87 Merge branch 'numbers-can-map-to-strings' of https://github.com/crayment/RestKit into crayment-numbers-can-map-to-strings
Conflicts:
	Code/ObjectMapping/RKObjectMappingOperation.m
	Specs/ObjectMapping/RKObjectMappingOperationSpec.m
2011-08-27 19:32:35 -04:00
Nolan Waite
8520d3e28b Transform numbers to decimal numbers. 2011-08-25 23:15:07 -04:00
Blake Watters
1f66ce7e46 Added support for mapping a single object into a destination collections. fixes #310 2011-08-25 22:21:54 -04:00
Blake Watters
2e430644d9 Added support for using NSEntityDescription to lookup property types for NSManagedObject attribute and relationships. This enables mapping type transformations on mappings defined against Core Data entities instead of concrete subclasses. fixes #233 2011-08-14 23:21:51 -04:00
Blake Watters
47c78b181c Adding trace mapping for RKObjectMappingOperation 2011-08-14 21:25:13 -04:00
Cody Rayment
46fc65efb3 Allow numbers to map to strings 2011-08-10 00:08:31 -06:00
Blake Watters
4e03ba7bef Renamed Polymorphic mapping to dynamic mapping after consulting with the community. Dropped abstract superclass in favor of a RKObjectMappingDefinition protocol. Caught missing cases with dynamic object mapping + targetObject. Updated docs and method signatures to reflect the updates. 2011-07-31 19:37:42 -04:00
Blake Watters
670234b775 Added support for polymorphic object mapping (Github #105, #244). This enables you to dynamically map objects to different destination classes or using different mapping strategies via configuration or callbacks. See Docs/Object Mapping.md for details.
Other changes include:
* Eliminated the RKObjectFactory protocol and implementations. Object mapping instances themselves are
now responsible for instantiating target objects for mapping.
* Introduced RKObjectAbstractMapping superclass for RKObjectMapping and RKObjectPolymorphicMapping.
* Updated example applications to use block object loaders (RKTwitter and RKTwitterCoreData)
* Refactored method signatures of RKObjectMapper, RKObjectMapping, and RKObjectMappingProvider to reflect the
existence of abstract mapping types. This was necessary to make polymorphic mappings integrate cleanly.
* Fixed overlap in RestKit error domains between network and object mapping. fixes #208
2011-07-30 16:00:36 -04:00
Blake Watters
bd29ee038b Added non-underscored class name for NSCFBoolean matches in transformation from Boolean to String 2011-07-27 08:00:15 -04:00
Blake Watters
570b13ca07 Updated Object Mapping documentation, added support for inferring object mappings based off of the type of the object used in postObject:, putObject:, etc. Made KVC validation optional. 2011-07-23 23:47:03 -04:00
Blake Watters
73fb461a8b Reworked object mapping behaviors to better accommodate situations where the server side responds with a successful status code and a payload that does not contain any mappable attributes or relationships. We now consider this to be successful. If a mapping operation is performed that does not result in any mappings being applied, it will return NO without setting an error. If an instance of RKObjectMapper is invoked that does not find any mappable content in the payload, this will result in an unmappable content error. The object loader guards against this by not attempting to map any empty payloads. This should ensure that you only get the unmappable content error if you have asked RK to load and map a payload it cannot find an object mapping for. 2011-07-07 09:53:46 -04:00
Duncan Lewis
403bf29f57 Added helper functions to RKObjectSerializer to map local objects into json 2011-06-30 12:28:28 -04:00
Blake Watters
6faa525344 Added specs and support for either failing out the mapping operation or skipping over an attribute depending on key/value validation response. If NO is returned and a validation error is returned, the mapping operation will fail. If NO is returned without an error, the attribute will be skipped and a warning will be logged. You can also mutate the values. closes #166 2011-06-29 15:07:43 -04:00
Scott Penrose
41071ad61a Added Key-Value validation checking during object mapping operation. If you return NO it will continue mapping but skip that key path. If you set the error it will error out of object mapping operation. Issue #166 2011-06-29 14:11:00 -04:00
Blake Watters
3dfbaf1810 Updated to support setting default value instead of nil when an attribute is missing in the payload. For Core Data backed models, we consult the entity definition to obtain the default value. closes #117 2011-06-28 15:22:04 -04:00
Blake Watters
0954d4a063 Fixing more memory leaks 2011-06-20 15:03:35 -04:00
Blake Watters
3bf4b7bc0f Implemented nested mapping for structures similar to the BuildBot JSON structure. fixes #112 2011-06-17 15:36:28 -04:00
Jeremy Ellison
ae68829ec4 transform booleans to strings 2011-06-16 19:30:10 -04:00
Blake Watters
323d5e30b1 Add support for mapping from NSNumber to NSDate by coercing to a time interval since 1970. fixes #141 2011-06-16 17:33:21 -04:00
Blake Watters
420d20384f Add support for mapping yes and no to NSNumber boolean values 2011-06-15 09:59:45 -04:00
Blake Watters
27ea307816 Fix crash in RKCatalog. Suppress warning about symbol visibility during linking. 2011-06-11 20:27:33 -04:00
Blake Watters
9299cabc11 Implemented flexible logging solution utilizing the excellent LibComponentLogging library. 2011-06-11 20:25:28 -04:00
Blake Watters
7bf3e0f273 Added support for mapping boolean strings to NSNumber with values t or f in addition to true and false. refs #130 2011-06-11 19:31:21 -04:00
Blake Watters
f3c0995d5e Implementation of Object Mapping 2.0 design:
* Removed RestKit from inheritance hierarchy
  * Mappings are implemented as concrete classes
  * Mapper is much more flexible & powerful
  * Much more robust error handling
  * Serialization is reimplemented as an object mapping operation
  * Added ability to serialize to JSON natively
  * Reworked Core Data integration
  * Simplified the codebase substantially
2011-06-11 19:26:56 -04:00