Commit Graph

62 Commits

Author SHA1 Message Date
Blake Watters
a4bdc03961 Add RKLog helper for displaying detailed key-value validation failure information. closes #750 2012-05-21 13:04:49 -04:00
Blake Watters
016f13dad0 Convert all tabs to four spaces. refs #743 2012-05-17 18:10:59 -04:00
Blake Watters
fcb973056b Cleanup trailing whitespace. refs #743 2012-05-17 18:00:16 -04:00
Blake Watters
6bbc00296d Add delegate methods to RKObjectMappingOperationDelegate for tracking mappable content that is not
set due to an unchanged value. Update RKMapperTest to correctly validate mappings that do not result
in a value change (typically nil => nil). closes #72, fixes #634
2012-05-09 19:12:09 -04:00
Blake Watters
457a6126cf Refresh copyright notices for all source files 2012-04-04 09:08:54 -04:00
Blake Watters
73fe4f1237 Added support for object mapping a single object instance onto an NSOrderedSet collection. fixes #616 2012-03-30 09:29:41 -04:00
Bob Spryn
8fc0d9e46c Added test and fix for empty date @"" being set to a very strange date by the ISO date formatter". refs #622 2012-03-29 20:12:50 -04:00
Blake Watters
bc82f5a1ac Integrated support and test coverage for mapping relationships onto NSOrderedSet values. closes #578 2012-03-20 22:14:31 -04:00
Blake Watters
896de8f1eb Respect modified values set for properties within key-value validation callbacks. fixes #565 2012-03-12 20:22:11 -04:00
Charlie Savage
08e65ac108 Remove references to NSOrderedSet to maintain iOS 4.x compatability. 2012-03-11 14:48:56 -06:00
Blake Watters
6db4a0a170 Fix broken XML mapping in RKTwitter example. fixes #400 2012-02-25 14:16:09 -05:00
Blake Watters
6723502372 Merge branch 'hotfix/545-conditional-nsorderedset' into development 2012-02-25 12:03:48 -05:00
Blake Watters
e66f65bb5e Use runtime checks for NSOrderedSet class to enable building against iOS 4.x and OS X 10.6. fixes #568, #545 2012-02-25 11:44:13 -05:00
Blake Watters
c2e1cb0e4f Inform the delegate of object mapping events when relationships are set 2012-02-23 20:50:43 -05:00
Blake Watters
4d48ef4729 Fixed breakage in OS X support 2012-02-15 17:48:59 -05:00
Blake Watters
3d0f0ab39e Introduced the RKTableController component for iOS.
RKTableController provides a flexible, integrated system for driving iOS table views using
the RestKit object mapping engine. Local domain objects can be mapped into table cells within a
collection or presented for editing as part of a form. There are three flavors of table controllers
available:

* Static Tables: RKTableController can be used to render simple static tables that are composed of RKTableItems
presented in RKTableSections. Table items can quickly be built and added to a table without a backing model
or can have content object mapped into them for presentation.
* Network Tables: RKTableController can also render a table with the results of a network load. The typical use
case here is to have RestKit retrieve a JSON/XML payload from your remote system and then render the content into
a table.
* Core Data Tables: RKFetchedResultsTableController can efficiently drive a table view using objects pulled from a
Core Data managed object context. Typical use-cases here are for the presentation of large collections that are
pulled from a remote system, offering offline access, or speeding up a UI by using Core Data as a fast local cache.

RKTableController supports a number of bells and whistles including integrated searching/filtering and pull to refresh.
2012-02-10 16:30:54 -05:00
Blake Watters
d4e3c0d559 Remove Appledoc significant asterisk in non-documenting comment 2012-02-02 09:21:00 -05:00
Brian Morton
f92fbb9f8e Fix issue that caused appledoc to fall over while building documentation.
There's currently a known issue for appledoc (https://github.com/tomaz/appledoc/issues/147) that causes it to fall over when it encounters a method declaration in an implementation that is missing a type (even if its in the header file).  While this is valid Objective-C, lets update this to allow appledoc to go on its merry little way.

* Fix 1 declaration relating to atKeyPath: in RKObjectMapper.m
* Fix 2 declarations relating to atKeyPath: in RKObjectMapper_Private.h
* Fix 1 declaration relating to atKeyPath: in RKObjectMappingOperation.m

All declarations were changed to declare keyPath as an (NSString *).
2012-01-28 13:40:38 -08:00
Jeff Arena
aac9abc0ad Audit uses of setValue:forKey: in mapping operations and replace with setValue:forKeyPath: where appropriate. Fixes #421. 2012-01-21 13:11:35 -05:00
Christopher Swasey
b1f4e1ffe5 RKObjectMappingOperation#parseDateFromString now transforms string representations of integers into dates as if they were unix timestamps 2012-01-20 12:59:16 -05:00
Jeff Arena
db0646ed19 Change NSNumber -> NSDate transformation to use doubleValue instead of intValue to ensure we do not lose precision on date conversion. Fixes #455. 2012-01-20 11:57:47 -05:00
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