Commit Graph

99 Commits

Author SHA1 Message Date
Julien Grimault
a1e2061106 Modified asserts in RKObjectLoader processMappingResult to allow synchronous requests. 2011-12-13 20:58:15 -05:00
Ray Fix
f23b242e87 First cut at issue 451, shouldDeleteOrphanedObject.
The test is currently failing and the 6 results are
returned instead of keeping alive only the original
4 result objects.  Requires further investigation.
2011-12-11 09:13:35 -08:00
Blake Watters
4a45a15da1 Fixed nearly all broken tests for OS X target 2011-12-09 00:30:34 -05:00
Blake Watters
479864902b Fixed all build warnings on OS X Framework target 2011-12-08 23:23:20 -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
f5008ff9fe Cleaned up broken specs for iOS. 2011-12-02 09:26:35 -05:00
Blake Watters
5b718890ac Checking in work in progress on the library reorganization 2011-12-02 09:26:35 -05:00
Blake Watters
70e2accd1d Remove performSelector invocations that have resulted in App Store rejections. fixes #442 2011-11-17 15:32:48 -05:00
Blake Watters
585d4aafc8 Implemented MIMETypeForPathExtension for NSURL and NSString. refs #409
Refactored duplicated code for returning the MIME Type based on file path extension using
Core Services UTI.
2011-10-16 02:06:58 -04:00
Blake Watters
c29046075f Merge pull request #399 from Felixyz/validationErrorLogging
Log much-needed info when context fails to save
2011-10-12 20:03:59 -07:00
Felix Holmgren
a235610ab4 Log much-needed info when context fails to save
* Makes it much easier to debug Core Data validation problems
  * Adapted from code by Chris Lozach
  * See: http://stackoverflow.com/questions/1283960/iphone-core-data-unresolved-error-while-saving
2011-10-12 21:04:57 +02: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
2f91e71c3a Merge pull request #356 from jobi/master
Allow specifying the bundle when seeding from a file
2011-09-21 05:52:24 -07:00
Blake Watters
0b5233916a Fixed bug where relationship connection was working off of source keyPath instead of destination (i.e. relationship name). fixes #357 2011-09-20 19:20:19 -04:00
Johan Bilien
cee8f13c6c Add a way to specify the bundle from seeding from a file
[NSBundle mainBundle] doesn't work for logic tests, which don't have an
application bundle.
2011-09-20 16:01:14 -04:00
Blake Watters
0c96aedc85 Fix use of reserved 'class' keyword that breaks import into Objective-C++. fixes #355
Added basic spec file that imports the public headers into an Objective-C++ source file.
2011-09-20 13:04:29 -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
52e5a7b911 AppDirectory return value was incorrect for OSX Core Data. Fixes #350. Thanks @martijnthe 2011-09-18 12:00:23 -05: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
Blake Watters
05b94cae5d Added assertions for object store nilness.
The managedObjectContext helper method will now raise an exception if there is not a sharedManager or the current sharedManager does not have an objectStore configured.
2011-09-13 13:13:12 -04:00
Parker
c888af6f25 Added Apache License header to files in CoreData directory
Didn't add header to NSManagedObject+ActiveRecord.h,
NSManagedObject+ActiveRecord.m and RKManagedObjectCache.h .
NSManagedObject+ActiveRecord was adapted from someone else, and
RKManagedObjectCache has different code formatting. Will update those
once I get confirmation on them.
2011-09-07 11:55:17 -04:00
Blake Watters
b96940cc64 Eliminated requirement to use -all_load linker flag. Fixed breakage in OS X builds due to ivar/property name disagreement. Removed references to all_load from the install docs. fixes #239 2011-09-01 20:52:46 -04:00
emil.wojtaszek
de5b7111a1 bug fix with wrong path to data store on mac 2011-08-25 20:38:33 -04:00
Blake Watters
272b161732 Fix incorrect import causing build breakage. fixes #299 2011-08-15 08:02:14 -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
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
d12568580d Merge pull request #234 from GateGuru/unit-testing-and-queue-fixes
Unit testing and queue fixes
2011-07-22 05:15:01 -07:00
Blake Watters
f1b0815e1a Fixes to some violations of the contracts around delegate methods and background threads 2011-07-21 22:01:47 -04:00
Blake Watters
7246afc998 Fixes to enable RestKit Core Data to be easily unit tested from a Unit Testing bundle. Improved thread safety in the request queue and fixed an issue where requests dispatched from background threads would not get callback methods due to thread termination. The request queue now guarantees requests are sent from the main thread. 2011-07-21 11:33:17 -04:00
Blake Watters
40eb842dcc Store new objects by lookupValue instead of primaryKeyValue. This avoids creation of duplicated objects the are manufactured by findOrCreateInstanceOfEntity: 2011-07-07 22:40:46 -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
Blake Watters
e86507f4ed Bug fix for potential invocation of setObject:forKey: with a nil key value 2011-07-05 16:30:16 -04:00
Blake Watters
f0e8e8d44f Coerce primary keys to strings in the thread-local lookup cache to handle lookups for numeric or string keys coming back in the JSON 2011-07-02 15:03:08 -04:00
Blake Watters
72f26690ed Fixing crash from over-release of RKParams. 2011-06-30 17:19:12 -04:00
Blake Watters
2ac45f5ccc Refactored object loaders to provide easier support for non-nested JSON responses. There are new flavors of getObject:, postObject:, etc.
that allow the developer to explicitly specify the object mapping to use for processing the response. closes #168
2011-06-30 10:33:39 -04:00
Blake Watters
2e7adbdc1e Restore the managed object cache functionality and add test coverage so it does not break again. fixes #167 2011-06-29 22:08:35 -04:00
Blake Watters
d57b784c30 Don't delete the managed object unless we were responsible for saving it in the first place. closes #125 2011-06-29 21:04:17 -04:00
Blake Watters
2a8ece97c1 Improvements to reachability, the request queue, logging throughout the network layer, decoupling of components via notifications, reliability improvements for unit tests in the cache layer. Improved thread-local cleanup routines inside the managed object store. Changing base URL's is now more reliable. fixes #171, #158, #113, #104, #102 2011-06-29 13:28:14 -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
e4320f7ea9 Added error reporting when RKManagedObjectLoader fails to save the object context. This was silently masking validation failures post-mapping. 2011-06-24 15:59:40 -04:00
Blake Watters
4773542a9e Fix breakage in Core Data 2011-06-23 09:21:54 -04:00
Blake Watters
1ab61ad735 Check for nil target object ID before performing deletion. Log info about the process. 2011-06-21 10:13:34 -04:00
Jeremy Ellison
a5cc456351 Merge branch 'restkit-sprint' of github.com:twotoasters/RestKit into restkit-sprint 2011-06-20 10:51:30 -04:00
Jeremy Ellison
de154e21b8 Fix -reset in RKManagedObjectLoader.m 2011-06-20 10:50:56 -04:00
Blake Watters
3204682f72 Added object mapping management to the mapping provider for folks who don't have keyPaths. Deprecated setMapping:forKeyPath: in favor of setObjectMapping:forKeyPath: for consistency with the other method signatures. 2011-06-20 10:49:40 -04:00
Daniel Hammond
e9e4c83630 Merge branch 'restkit-sprint' of github.com:twotoasters/RestKit into restkit-sprint 2011-06-16 21:17:31 -04:00
Daniel Hammond
d9fc311433 Remove objects persisted to Core Dataduring postObject: when there is an error (Fix Issue #125) 2011-06-16 21:17:14 -04:00
Duncan Lewis
ed9260abcd Issue #106 added requested change in RKManagedObjectStore.m 2011-06-16 18:47:42 -04:00
Duncan Lewis
61de21f0d1 Applied fix for RestKit issue #89 2011-06-16 18:29:21 -04:00