Permalink
Browse files

Merge branch 'hotfix/0.10.2'

  • Loading branch information...
2 parents f11a538 + 149edd9 commit 8d5e3156b7adcdc59d6e1db26bb6b4af34d65cbc @blakewatters blakewatters committed Aug 8, 2012
Showing with 8,025 additions and 6,121 deletions.
  1. +1 −0 Code/CoreData/CoreData.h
  2. +5 −5 Code/CoreData/NSEntityDescription+RKAdditions.h
  3. +4 −4 Code/CoreData/NSEntityDescription+RKAdditions.m
  4. +15 −15 Code/CoreData/NSManagedObject+ActiveRecord.h
  5. +54 −35 Code/CoreData/NSManagedObject+ActiveRecord.m
  6. +1 −1 Code/CoreData/NSManagedObjectContext+RKAdditions.m
  7. +2 −1 Code/CoreData/RKEntityByAttributeCache.m
  8. +1 −1 Code/CoreData/RKInMemoryManagedObjectCache.m
  9. +3 −4 Code/CoreData/RKManagedObjectLoader.h
  10. +38 −26 Code/CoreData/RKManagedObjectLoader.m
  11. +0 −2 Code/CoreData/RKManagedObjectMapping.h
  12. +39 −24 Code/CoreData/RKManagedObjectMapping.m
  13. +19 −16 Code/CoreData/RKManagedObjectMappingOperation.m
  14. +3 −5 Code/CoreData/RKManagedObjectSearchEngine.h
  15. +19 −14 Code/CoreData/RKManagedObjectSearchEngine.m
  16. +9 −10 Code/CoreData/RKManagedObjectSeeder.h
  17. +40 −32 Code/CoreData/RKManagedObjectSeeder.m
  18. +13 −19 Code/CoreData/RKManagedObjectStore.h
  19. +69 −46 Code/CoreData/RKManagedObjectStore.m
  20. +6 −7 Code/CoreData/RKManagedObjectThreadSafeInvocation.h
  21. +32 −22 Code/CoreData/RKManagedObjectThreadSafeInvocation.m
  22. +4 −2 Code/CoreData/RKObjectMappingProvider+CoreData.m
  23. +2 −2 Code/CoreData/RKObjectPropertyInspector+CoreData.h
  24. +14 −12 Code/CoreData/RKObjectPropertyInspector+CoreData.m
  25. +6 −6 Code/CoreData/RKSearchWord.h
  26. +8 −4 Code/CoreData/RKSearchWordObserver.m
  27. +1 −1 Code/CoreData/RKSearchableManagedObject.m
  28. +5 −4 Code/Network/NSData+RKAdditions.m
  29. +1 −1 Code/Network/NSObject+URLEncoding.h
  30. +3 −2 Code/Network/NSObject+URLEncoding.m
  31. +0 −21 Code/Network/RKClient.h
  32. +83 −43 Code/Network/RKClient.m
  33. +1 −10 Code/Network/RKOAuthClient.h
  34. +20 −14 Code/Network/RKOAuthClient.m
  35. +56 −30 Code/Network/RKParams.m
  36. +0 −6 Code/Network/RKParamsAttachment.h
  37. +28 −18 Code/Network/RKParamsAttachment.m
  38. +0 −4 Code/Network/RKReachabilityObserver.h
  39. +53 −30 Code/Network/RKReachabilityObserver.m
  40. +1 −6 Code/Network/RKRequest.h
  41. +134 −104 Code/Network/RKRequest.m
  42. +56 −40 Code/Network/RKRequestCache.m
  43. +0 −5 Code/Network/RKRequestQueue.h
  44. +108 −71 Code/Network/RKRequestQueue.m
  45. +1 −4 Code/Network/RKRequestSerialization.h
  46. +12 −6 Code/Network/RKRequestSerialization.m
  47. +1 −1 Code/Network/RKRequest_Internals.h
  48. +0 −2 Code/Network/RKResponse.h
  49. +127 −69 Code/Network/RKResponse.m
  50. +34 −18 Code/Network/RKURL.m
  51. +1 −5 Code/ObjectMapping/RKDynamicObjectMapping.h
  52. +18 −11 Code/ObjectMapping/RKDynamicObjectMapping.m
  53. +7 −9 Code/ObjectMapping/RKDynamicObjectMappingMatcher.h
  54. +12 −6 Code/ObjectMapping/RKDynamicObjectMappingMatcher.m
  55. +2 −4 Code/ObjectMapping/RKErrorMessage.h
  56. +4 −2 Code/ObjectMapping/RKErrorMessage.m
  57. +14 −7 Code/ObjectMapping/RKMappingOperationQueue.m
  58. +1 −4 Code/ObjectMapping/RKObjectAttributeMapping.h
  59. +14 −8 Code/ObjectMapping/RKObjectAttributeMapping.m
  60. +3 −5 Code/ObjectMapping/RKObjectLoader.h
  61. +62 −39 Code/ObjectMapping/RKObjectLoader.m
  62. +3 −3 Code/ObjectMapping/RKObjectLoader_Internals.h
  63. +11 −11 Code/ObjectMapping/RKObjectManager.h
  64. +99 −59 Code/ObjectMapping/RKObjectManager.m
  65. +14 −14 Code/ObjectMapping/RKObjectMapper.h
  66. +36 −20 Code/ObjectMapping/RKObjectMapper.m
  67. +1 −1 Code/ObjectMapping/RKObjectMapper_Private.h
  68. +28 −34 Code/ObjectMapping/RKObjectMapping.h
  69. +132 −79 Code/ObjectMapping/RKObjectMapping.m
  70. +81 −61 Code/ObjectMapping/RKObjectMappingOperation.m
  71. +2 −2 Code/ObjectMapping/RKObjectMappingProvider.h
  72. +108 −55 Code/ObjectMapping/RKObjectMappingProvider.m
  73. +13 −7 Code/ObjectMapping/RKObjectMappingProviderContextEntry.m
  74. +4 −4 Code/ObjectMapping/RKObjectMappingResult.h
  75. +21 −14 Code/ObjectMapping/RKObjectMappingResult.m
  76. +37 −19 Code/ObjectMapping/RKObjectPaginator.m
  77. +3 −3 Code/ObjectMapping/RKObjectPropertyInspector.h
  78. +19 −13 Code/ObjectMapping/RKObjectPropertyInspector.m
  79. +4 −7 Code/ObjectMapping/RKObjectRelationshipMapping.h
  80. +10 −6 Code/ObjectMapping/RKObjectRelationshipMapping.m
  81. +8 −8 Code/ObjectMapping/RKObjectRouter.h
  82. +22 −11 Code/ObjectMapping/RKObjectRouter.m
  83. +7 −10 Code/ObjectMapping/RKObjectSerializer.h
  84. +20 −13 Code/ObjectMapping/RKObjectSerializer.m
  85. +18 −9 Code/ObjectMapping/RKParserRegistry.m
  86. +1 −1 Code/ObjectMapping/RKRouter.h
  87. +1 −1 Code/Support/NSArray+RKAdditions.m
  88. +17 −11 Code/Support/NSBundle+RKAdditions.m
  89. +21 −14 Code/Support/NSDictionary+RKAdditions.m
  90. +2 −2 Code/Support/NSString+RKAdditions.h
  91. +45 −31 Code/Support/NSString+RKAdditions.m
  92. +4 −2 Code/Support/NSURL+RKAdditions.m
  93. +4 −2 Code/Support/Parsers/JSON/RKJSONParserJSONKit.m
  94. +4 −2 Code/Support/Parsers/XML/RKXMLParserXMLReader.m
  95. +2 −2 Code/Support/RKAlert.h
  96. +3 −3 Code/Support/RKAlert.m
  97. +21 −11 Code/Support/RKBenchmark.m
  98. +11 −11 Code/Support/RKCache.h
  99. +51 −39 Code/Support/RKCache.m
  100. +3 −3 Code/Support/RKDotNetDateFormatter.h
  101. +18 −10 Code/Support/RKDotNetDateFormatter.m
  102. +3 −3 Code/Support/RKErrors.h
  103. +3 −3 Code/Support/RKErrors.m
  104. +1 −1 Code/Support/RKLog.h
  105. +4 −4 Code/Support/RKLog.m
  106. +4 −4 Code/Support/RKMIMETypes.h
  107. +4 −4 Code/Support/RKMIMETypes.m
  108. +34 −18 Code/Support/RKMutableBlockDictionary.m
  109. +8 −13 Code/Support/RKPathMatcher.h
  110. +42 −31 Code/Support/RKPathMatcher.m
  111. +2 −2 Code/Support/RKPortCheck.m
  112. +1 −1 Code/Support/RKSearchEngine.m
  113. +5 −5 Code/Testing/RKMappingTest.h
  114. +38 −19 Code/Testing/RKMappingTest.m
  115. +10 −5 Code/Testing/RKMappingTestExpectation.m
  116. +3 −3 Code/Testing/RKTableControllerTestDelegate.h
  117. +26 −19 Code/Testing/RKTableControllerTestDelegate.m
  118. +7 −7 Code/Testing/RKTestFactory.m
  119. +16 −8 Code/Testing/RKTestFixture.m
  120. +1 −1 Code/Testing/RKTestNotificationObserver.h
  121. +18 −9 Code/Testing/RKTestNotificationObserver.m
  122. +32 −16 Code/Testing/RKTestResponseLoader.m
  123. +30 −30 Code/UI/RKAbstractTableController.h
  124. +241 −135 Code/UI/RKAbstractTableController.m
  125. +1 −1 Code/UI/RKAbstractTableController_Internals.h
  126. +25 −15 Code/UI/RKControlTableItem.m
  127. +2 −1 Code/UI/RKControlTableViewCell.m
  128. +0 −2 Code/UI/RKFetchedResultsTableController.h
  129. +124 −73 Code/UI/RKFetchedResultsTableController.m
  130. +2 −2 Code/UI/RKForm.h
  131. +64 −33 Code/UI/RKForm.m
  132. +33 −20 Code/UI/RKFormSection.m
  133. +8 −4 Code/UI/RKObjectManager+RKTableController.m
  134. +2 −2 Code/UI/RKRefreshGestureRecognizer.h
  135. +28 −14 Code/UI/RKRefreshGestureRecognizer.m
  136. +8 −8 Code/UI/RKRefreshTriggerView.h
  137. +34 −18 Code/UI/RKRefreshTriggerView.m
  138. +3 −3 Code/UI/RKTableController.h
  139. +126 −77 Code/UI/RKTableController.m
  140. +2 −2 Code/UI/RKTableItem.h
  141. +37 −22 Code/UI/RKTableItem.m
  142. +10 −13 Code/UI/RKTableSection.h
  143. +35 −22 Code/UI/RKTableSection.m
  144. +4 −4 Code/UI/RKTableViewCellMapping.h
  145. +58 −30 Code/UI/RKTableViewCellMapping.m
  146. +4 −4 Code/UI/RKTableViewCellMappings.h
  147. +12 −7 Code/UI/RKTableViewCellMappings.m
  148. +6 −4 Code/UI/UIImage+RKAdditions.m
  149. +1 −1 Code/UI/UIView+FindFirstResponder.h
  150. +4 −3 Code/UI/UIView+FindFirstResponder.m
  151. +7 −7 Docs/Object Mapping.md
  152. +1 −1 Examples/RKCatalog/App/RKCatalog.h
  153. +4 −2 Examples/RKCatalog/App/RKCatalogAppDelegate.m
  154. +1 −1 Examples/RKCatalog/App/RootViewController.h
  155. +15 −9 Examples/RKCatalog/App/RootViewController.m
  156. +12 −6 Examples/RKCatalog/Examples/RKAuthenticationExample/RKAuthenticationExample.m
  157. +6 −6 Examples/RKCatalog/Examples/RKBackgroundRequestExample/RKBackgroundRequestExample.h
  158. +18 −10 Examples/RKCatalog/Examples/RKBackgroundRequestExample/RKBackgroundRequestExample.m
  159. +2 −2 Examples/RKCatalog/Examples/RKCoreDataExample/RKCoreDataExample.h
  160. +30 −21 Examples/RKCatalog/Examples/RKCoreDataExample/RKCoreDataExample.m
  161. +2 −2 Examples/RKCatalog/Examples/RKKeyValueMappingExample/RKKeyValueMappingExample.h
  162. +23 −19 Examples/RKCatalog/Examples/RKKeyValueMappingExample/RKKeyValueMappingExample.m
  163. +11 −11 Examples/RKCatalog/Examples/RKParamsExample/RKParamsExample.h
  164. +17 −10 Examples/RKCatalog/Examples/RKParamsExample/RKParamsExample.m
  165. +9 −5 Examples/RKCatalog/Examples/RKReachabilityExample/RKReachabilityExample.m
  166. +10 −10 Examples/RKCatalog/Examples/RKRelationshipMappingExample/Project.h
  167. +2 −2 Examples/RKCatalog/Examples/RKRelationshipMappingExample/RKRelationshipMappingExample.h
  168. +33 −22 Examples/RKCatalog/Examples/RKRelationshipMappingExample/RKRelationshipMappingExample.m
  169. +4 −4 Examples/RKCatalog/Examples/RKRelationshipMappingExample/Task.h
  170. +4 −4 Examples/RKCatalog/Examples/RKRelationshipMappingExample/User.h
  171. +17 −9 Examples/RKCatalog/Examples/RKRequestQueueExample/RKRequestQueueExample.m
  172. +4 −2 Examples/RKMacOSX/RKMacOSX/RKMacOSXAppDelegate.m
  173. +14 −14 Examples/RKTwitter/Classes/RKTStatus.h
  174. +4 −2 Examples/RKTwitter/Classes/RKTStatus.m
  175. +6 −6 Examples/RKTwitter/Classes/RKTUser.h
  176. +2 −1 Examples/RKTwitter/Classes/RKTUser.m
  177. +10 −8 Examples/RKTwitter/Classes/RKTwitterAppDelegate.m
  178. +2 −2 Examples/RKTwitter/Classes/RKTwitterViewController.h
  179. +23 −14 Examples/RKTwitter/Classes/RKTwitterViewController.m
  180. +1 −1 Examples/RKTwitter/main.m
  181. +6 −6 Examples/RKTwitterCoreData/Classes/RKTStatus.h
  182. +11 −9 Examples/RKTwitterCoreData/Classes/RKTwitterAppDelegate.m
  183. +2 −2 Examples/RKTwitterCoreData/Classes/RKTwitterViewController.h
  184. +32 −21 Examples/RKTwitterCoreData/Classes/RKTwitterViewController.m
  185. +1 −1 Examples/RKTwitterCoreData/main.m
  186. +1 −1 Examples/RestKit CLI/RestKit CLI/main.m
  187. +505 −441 Tests/Application/UI/RKFetchedResultsTableControllerTest.m
  188. +14 −7 Tests/Application/UI/RKFormTest.m
  189. +811 −678 Tests/Application/UI/RKTableControllerTest.m
  190. +8 −4 Tests/Application/UI/RKTableViewCellMappingTest.m
  191. +20 −16 Tests/Application/UI/RKTableViewCellMappingsTest.m
  192. +43 −34 Tests/Application/UI/RKTableViewSectionTest.m
  193. +2 −2 Tests/Logic/CoreData/NSManagedObject+ActiveRecordTest.m
  194. +2 −1 Tests/Logic/CoreData/RKEntityByAttributeCacheTest.m
  195. +43 −36 Tests/Logic/CoreData/RKManagedObjectLoaderTest.m
  196. +143 −125 Tests/Logic/CoreData/RKManagedObjectMappingOperationTest.m
  197. +79 −64 Tests/Logic/CoreData/RKManagedObjectMappingTest.m
  198. +52 −44 Tests/Logic/CoreData/RKManagedObjectThreadSafeInvocationTest.m
  199. +6 −4 Tests/Logic/CoreData/RKSearchWordObserverTest.m
  200. +4 −3 Tests/Logic/CoreData/RKSearchableManagedObjectTest.m
  201. +18 −14 Tests/Logic/Network/RKAuthenticationTest.m
  202. +50 −35 Tests/Logic/Network/RKClientTest.m
  203. +9 −5 Tests/Logic/Network/RKOAuthClientTest.m
  204. +10 −6 Tests/Logic/Network/RKParamsAttachmentTest.m
  205. +31 −26 Tests/Logic/Network/RKParamsTest.m
  206. +83 −64 Tests/Logic/Network/RKRequestQueueTest.m
  207. +308 −251 Tests/Logic/Network/RKRequestTest.m
  208. +91 −64 Tests/Logic/Network/RKResponseTest.m
  209. +58 −34 Tests/Logic/Network/RKURLTest.m
  210. +33 −27 Tests/Logic/ObjectMapping/RKDynamicObjectMappingTest.m
  211. +223 −182 Tests/Logic/ObjectMapping/RKObjectLoaderTest.m
  212. +104 −83 Tests/Logic/ObjectMapping/RKObjectManagerTest.m
  213. +742 −635 Tests/Logic/ObjectMapping/RKObjectMappingNextGenTest.m
  214. +130 −109 Tests/Logic/ObjectMapping/RKObjectMappingOperationTest.m
  215. +56 −31 Tests/Logic/ObjectMapping/RKObjectMappingProviderTest.m
  216. +11 −8 Tests/Logic/ObjectMapping/RKObjectMappingResultTest.m
  217. +85 −43 Tests/Logic/ObjectMapping/RKObjectPaginatorTest.m
  218. +59 −45 Tests/Logic/ObjectMapping/RKObjectRouterTest.m
  219. +95 −82 Tests/Logic/ObjectMapping/RKObjectSerializerTest.m
  220. +16 −10 Tests/Logic/ObjectMapping/RKParserRegistryTest.m
  221. +21 −14 Tests/Logic/Support/NSDictionary+RKRequestSerializationTest.m
  222. +15 −8 Tests/Logic/Support/NSStringRestKitTest.m
  223. +18 −9 Tests/Logic/Support/RKDotNetDateFormatterTest.m
  224. +4 −3 Tests/Logic/Support/RKJSONParserJSONKitTest.m
  225. +10 −7 Tests/Logic/Support/RKMutableBlockDictionaryTest.m
  226. +25 −14 Tests/Logic/Support/RKPathMatcherTest.m
  227. +52 −42 Tests/Logic/Support/RKXMLParserTest.m
  228. +12 −12 Tests/Models/RKCat.h
  229. +2 −2 Tests/Models/RKDynamicMappingModels.h
  230. +4 −4 Tests/Models/RKEvent.h
  231. +8 −8 Tests/Models/RKHouse.h
  232. +2 −1 Tests/Models/RKHuman.m
  233. +4 −4 Tests/Models/RKMappableAssociation.h
  234. +2 −1 Tests/Models/RKMappableAssociation.m
  235. +12 −12 Tests/Models/RKMappableObject.h
  236. +6 −6 Tests/Models/RKObjectLoaderTestResultModel.h
  237. +6 −6 Tests/Models/RKObjectMapperTestModel.h
  238. +5 −5 Tests/Models/RKResident.h
  239. +2 −2 Tests/Models/RKSearchable.h
  240. +2 −1 Tests/Models/RKSearchable.m
  241. +9 −9 Tests/Models/RKTestAddress.h
  242. +5 −3 Tests/Models/RKTestAddress.m
  243. +28 −28 Tests/Models/RKTestUser.h
  244. +10 −6 Tests/Models/RKTestUser.m
  245. +1 −1 Tests/RKTestEnvironment.h
  246. +1 −1 Tests/RKTestEnvironment.m
  247. +1 −1 VERSION
  248. +43 −39 Vendor/JSONKit/JSONKit.m
  249. +13 −23 Vendor/cocoa-oauth/GCOAuth.h
  250. +66 −124 Vendor/cocoa-oauth/GCOAuth.m
View
@@ -23,6 +23,7 @@
#import "NSManagedObject+ActiveRecord.h"
#import "RKManagedObjectStore.h"
#import "RKManagedObjectSeeder.h"
+#import "RKManagedObjectLoader.h"
#import "RKManagedObjectMapping.h"
#import "RKManagedObjectMappingOperation.h"
#import "RKManagedObjectCaching.h"
@@ -71,22 +71,22 @@ extern NSString * const RKEntityDescriptionPrimaryKeyAttributeValuePredicateSubs
value. This predicate is constructed by evaluating the cached predicate returned by the
predicateForPrimaryKeyAttribute with a dictionary of substitution variables specifying that
$PRIMARY_KEY_VALUE is equal to the given value.
-
+
**NOTE**: This method considers the type of the receiver's primary key attribute when constructing
- the predicate. It will coerce the given value into either an NSString or an NSNumber as
+ the predicate. It will coerce the given value into either an NSString or an NSNumber as
appropriate. This behavior is a convenience to avoid annoying issues related to Core Data's
handling of predicates for NSString and NSNumber types that were not appropriately casted.
-
+
@return A predicate speciying that the value of the primary key attribute is equal to a given value.
*/
- (NSPredicate *)predicateForPrimaryKeyAttributeWithValue:(id)value;
/**
Coerces the given value into the class representing the primary key. Currently support NSString
and NSNumber coercsions.
-
+
@bug **NOTE** This API is temporary and will be deprecated and replaced.
- @since 0.10.1
+ @since 0.10.1
*/
- (id)coerceValueForPrimaryKey:(id)primaryKeyValue;
@@ -38,14 +38,14 @@ - (Class)primaryKeyAttributeClass
if (attributeDescription) {
return NSClassFromString(attributeDescription.attributeValueClassName);
}
-
+
return nil;
}
- (NSString *)primaryKeyAttributeName
{
// Check for an associative object reference
- NSString *primaryKeyAttribute = (NSString *) objc_getAssociatedObject(self, &primaryKeyAttributeNameKey);
+ NSString *primaryKeyAttribute = (NSString *)objc_getAssociatedObject(self, &primaryKeyAttributeNameKey);
// Fall back to the userInfo dictionary
if (! primaryKeyAttribute) {
@@ -71,7 +71,7 @@ - (void)setPrimaryKeyAttributeName:(NSString *)primaryKeyAttributeName
- (NSPredicate *)predicateForPrimaryKeyAttribute
{
- return (NSPredicate *) objc_getAssociatedObject(self, &primaryKeyPredicateKey);
+ return (NSPredicate *)objc_getAssociatedObject(self, &primaryKeyPredicateKey);
}
- (id)coerceValueForPrimaryKey:(id)primaryKeyValue
@@ -92,7 +92,7 @@ - (id)coerceValueForPrimaryKey:(id)primaryKeyValue
}
}
}
-
+
return searchValue;
}
@@ -31,59 +31,59 @@
* The NSEntityDescription for the Subclass
* defaults to the subclass className, may be overridden
*/
-+ (NSEntityDescription*)entity;
++ (NSEntityDescription *)entity;
/**
* Returns an initialized NSFetchRequest for the entity, with no predicate
*/
-+ (NSFetchRequest*)fetchRequest;
++ (NSFetchRequest *)fetchRequest;
/**
* Fetches all objects from the persistent store identified by the fetchRequest
*/
-+ (NSArray*)objectsWithFetchRequest:(NSFetchRequest*)fetchRequest;
++ (NSArray *)objectsWithFetchRequest:(NSFetchRequest *)fetchRequest;
/**
* Retrieves the number of objects that would be retrieved by the fetchRequest,
* if executed
*/
-+ (NSUInteger)countOfObjectsWithFetchRequest:(NSFetchRequest*)fetchRequest;
++ (NSUInteger)countOfObjectsWithFetchRequest:(NSFetchRequest *)fetchRequest;
/**
* Fetches all objects from the persistent store via a set of fetch requests and
* returns all results in a single array.
*/
-+ (NSArray*)objectsWithFetchRequests:(NSArray*)fetchRequests;
++ (NSArray *)objectsWithFetchRequests:(NSArray *)fetchRequests;
/**
* Fetches the first object identified by the fetch request. A limit of one will be
* applied to the fetch request before dispatching.
*/
-+ (id)objectWithFetchRequest:(NSFetchRequest*)fetchRequest;
++ (id)objectWithFetchRequest:(NSFetchRequest *)fetchRequest;
/**
* Fetches all objects from the persistent store by constructing a fetch request and
* applying the predicate supplied. A short-cut for doing filtered searches on the objects
* of this class under management.
*/
-+ (NSArray*)objectsWithPredicate:(NSPredicate*)predicate;
++ (NSArray *)objectsWithPredicate:(NSPredicate *)predicate;
/**
* Fetches the first object matching a predicate from the persistent store. A fetch request
* will be constructed for you and a fetch limit of 1 will be applied.
*/
-+ (id)objectWithPredicate:(NSPredicate*)predicate;
++ (id)objectWithPredicate:(NSPredicate *)predicate;
/**
* Fetches all managed objects of this class from the persistent store as an array
*/
-+ (NSArray*)allObjects;
++ (NSArray *)allObjects;
/**
* Returns a count of all managed objects of this class in the persistent store. On
* error, will populate the error argument
*/
-+ (NSUInteger)count:(NSError**)error;
++ (NSUInteger)count:(NSError **)error;
/**
* Returns a count of all managed objects of this class in the persistent store. Deprecated
@@ -124,7 +124,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-+ (NSManagedObjectContext*)currentContext;
++ (NSManagedObjectContext *)currentContext;
+ (void)handleErrors:(NSError *)error;
@@ -152,8 +152,8 @@
+ (NSNumber *)numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm;
+ (NSNumber *)numberOfEntitiesWithPredicate:(NSPredicate *)searchTerm inContext:(NSManagedObjectContext *)context;
-+ (BOOL) hasAtLeastOneEntity;
-+ (BOOL) hasAtLeastOneEntityInContext:(NSManagedObjectContext *)context;
++ (BOOL)hasAtLeastOneEntity;
++ (BOOL)hasAtLeastOneEntityInContext:(NSManagedObjectContext *)context;
+ (NSFetchRequest *)requestAll;
+ (NSFetchRequest *)requestAllInContext:(NSManagedObjectContext *)context;
@@ -180,8 +180,8 @@
+ (NSArray *)findAllWithPredicate:(NSPredicate *)searchTerm inContext:(NSManagedObjectContext *)context;
+ (NSNumber *)maxValueFor:(NSString *)property;
-+ (id) objectWithMinValueFor:(NSString *)property;
-+ (id) objectWithMinValueFor:(NSString *)property inContext:(NSManagedObjectContext *)context;
++ (id)objectWithMinValueFor:(NSString *)property;
++ (id)objectWithMinValueFor:(NSString *)property inContext:(NSManagedObjectContext *)context;
+ (id)findFirst;
+ (id)findFirstInContext:(NSManagedObjectContext *)context;
@@ -28,17 +28,20 @@
@implementation NSManagedObjectContext (ActiveRecord)
-+ (NSManagedObjectContext *)defaultContext {
++ (NSManagedObjectContext *)defaultContext
+{
return defaultContext;
}
-+ (void)setDefaultContext:(NSManagedObjectContext *)newDefaultContext {
++ (void)setDefaultContext:(NSManagedObjectContext *)newDefaultContext
+{
[newDefaultContext retain];
[defaultContext release];
defaultContext = newDefaultContext;
}
-+ (NSManagedObjectContext *)contextForCurrentThread {
++ (NSManagedObjectContext *)contextForCurrentThread
+{
NSAssert([RKManagedObjectStore defaultObjectStore], @"[RKManagedObjectStore defaultObjectStore] cannot be nil");
return [[RKManagedObjectStore defaultObjectStore] managedObjectContextForCurrentThread];
}
@@ -51,109 +54,125 @@ @implementation NSManagedObject (ActiveRecord)
#pragma mark - RKManagedObject methods
-+ (NSEntityDescription*)entity {
- NSString* className = [NSString stringWithCString:class_getName([self class]) encoding:NSASCIIStringEncoding];
++ (NSEntityDescription *)entity
+{
+ NSString *className = [NSString stringWithCString:class_getName([self class]) encoding:NSASCIIStringEncoding];
return [NSEntityDescription entityForName:className inManagedObjectContext:[NSManagedObjectContext contextForCurrentThread]];
}
-+ (NSFetchRequest*)fetchRequest {
++ (NSFetchRequest *)fetchRequest
+{
NSFetchRequest *fetchRequest = [[[NSFetchRequest alloc] init] autorelease];
NSEntityDescription *entity = [self entity];
[fetchRequest setEntity:entity];
return fetchRequest;
}
-+ (NSArray*)objectsWithFetchRequest:(NSFetchRequest*)fetchRequest {
- NSError* error = nil;
- NSArray* objects = [[NSManagedObjectContext contextForCurrentThread] executeFetchRequest:fetchRequest error:&error];
++ (NSArray *)objectsWithFetchRequest:(NSFetchRequest *)fetchRequest
+{
+ NSError *error = nil;
+ NSArray *objects = [[NSManagedObjectContext contextForCurrentThread] executeFetchRequest:fetchRequest error:&error];
if (objects == nil) {
RKLogError(@"Error: %@", [error localizedDescription]);
}
return objects;
}
-+ (NSUInteger)countOfObjectsWithFetchRequest:(NSFetchRequest*)fetchRequest {
- NSError* error = nil;
++ (NSUInteger)countOfObjectsWithFetchRequest:(NSFetchRequest *)fetchRequest
+{
+ NSError *error = nil;
NSUInteger objectCount = [[NSManagedObjectContext contextForCurrentThread] countForFetchRequest:fetchRequest error:&error];
if (objectCount == NSNotFound) {
RKLogError(@"Error: %@", [error localizedDescription]);
}
return objectCount;
}
-+ (NSArray*)objectsWithFetchRequests:(NSArray*)fetchRequests {
- NSMutableArray* mutableObjectArray = [[NSMutableArray alloc] init];
- for (NSFetchRequest* fetchRequest in fetchRequests) {
++ (NSArray *)objectsWithFetchRequests:(NSArray *)fetchRequests
+{
+ NSMutableArray *mutableObjectArray = [[NSMutableArray alloc] init];
+ for (NSFetchRequest *fetchRequest in fetchRequests) {
[mutableObjectArray addObjectsFromArray:[self objectsWithFetchRequest:fetchRequest]];
}
- NSArray* objects = [NSArray arrayWithArray:mutableObjectArray];
+ NSArray *objects = [NSArray arrayWithArray:mutableObjectArray];
[mutableObjectArray release];
return objects;
}
-+ (id)objectWithFetchRequest:(NSFetchRequest*)fetchRequest {
++ (id)objectWithFetchRequest:(NSFetchRequest *)fetchRequest
+{
[fetchRequest setFetchLimit:1];
- NSArray* objects = [self objectsWithFetchRequest:fetchRequest];
+ NSArray *objects = [self objectsWithFetchRequest:fetchRequest];
if ([objects count] == 0) {
return nil;
} else {
return [objects objectAtIndex:0];
}
}
-+ (NSArray*)objectsWithPredicate:(NSPredicate*)predicate {
- NSFetchRequest* fetchRequest = [self fetchRequest];
++ (NSArray *)objectsWithPredicate:(NSPredicate *)predicate
+{
+ NSFetchRequest *fetchRequest = [self fetchRequest];
[fetchRequest setPredicate:predicate];
return [self objectsWithFetchRequest:fetchRequest];
}
-+ (id)objectWithPredicate:(NSPredicate*)predicate {
- NSFetchRequest* fetchRequest = [self fetchRequest];
++ (id)objectWithPredicate:(NSPredicate *)predicate
+{
+ NSFetchRequest *fetchRequest = [self fetchRequest];
[fetchRequest setPredicate:predicate];
return [self objectWithFetchRequest:fetchRequest];
}
-+ (NSArray*)allObjects {
++ (NSArray *)allObjects
+{
return [self objectsWithPredicate:nil];
}
-+ (NSUInteger)count:(NSError**)error {
- NSFetchRequest* fetchRequest = [self fetchRequest];
++ (NSUInteger)count:(NSError **)error
+{
+ NSFetchRequest *fetchRequest = [self fetchRequest];
return [[NSManagedObjectContext contextForCurrentThread] countForFetchRequest:fetchRequest error:error];
}
-+ (NSUInteger)count {
++ (NSUInteger)count
+{
NSError *error = nil;
return [self count:&error];
}
-+ (id)object {
++ (id)object
+{
id object = [[self alloc] initWithEntity:[self entity] insertIntoManagedObjectContext:[NSManagedObjectContext contextForCurrentThread]];
return [object autorelease];
}
-- (BOOL)isNew {
+- (BOOL)isNew
+{
NSDictionary *vals = [self committedValuesForKeys:nil];
return [vals count] == 0;
}
-+ (id)findByPrimaryKey:(id)primaryKeyValue inContext:(NSManagedObjectContext *)context {
++ (id)findByPrimaryKey:(id)primaryKeyValue inContext:(NSManagedObjectContext *)context
+{
NSPredicate *predicate = [[self entityDescriptionInContext:context] predicateForPrimaryKeyAttributeWithValue:primaryKeyValue];
if (! predicate) {
RKLogWarning(@"Attempt to findByPrimaryKey for entity with nil primaryKeyAttribute. Set the primaryKeyAttributeName and try again! %@", self);
return nil;
}
-
+
return [self findFirstWithPredicate:predicate inContext:context];
}
-+ (id)findByPrimaryKey:(id)primaryKeyValue {
++ (id)findByPrimaryKey:(id)primaryKeyValue
+{
return [self findByPrimaryKey:primaryKeyValue inContext:[NSManagedObjectContext contextForCurrentThread]];
}
#pragma mark - MagicalRecord Ported Methods
-+ (NSManagedObjectContext*)currentContext; {
++ (NSManagedObjectContext *)currentContext;
+{
return [NSManagedObjectContext contextForCurrentThread];
}
@@ -276,7 +295,7 @@ + (NSArray *)propertiesNamed:(NSArray *)properties
}
else
{
- RKLogError(@"Property '%@' not found in %@ properties for %@", propertyName, [propDict count], NSStringFromClass(self));
+ RKLogError(@"Property '%@' not found in %d properties for %@", propertyName, [propDict count], NSStringFromClass(self));
}
}
}
@@ -292,7 +311,7 @@ + (NSArray *)sortAscending:(BOOL)ascending attributes:(id)attributesToSortBy, ..
id attributeName;
va_list variadicArguments;
va_start(variadicArguments, attributesToSortBy);
- while ((attributeName = va_arg(variadicArguments, id))!= nil)
+ while ((attributeName = va_arg(variadicArguments, id)) != nil)
{
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:attributeName ascending:ascending];
[attributes addObject:sortDescriptor];
@@ -305,7 +324,7 @@ + (NSArray *)sortAscending:(BOOL)ascending attributes:(id)attributesToSortBy, ..
{
va_list variadicArguments;
va_start(variadicArguments, attributesToSortBy);
- [attributes addObject:[[[NSSortDescriptor alloc] initWithKey:attributesToSortBy ascending:ascending] autorelease] ];
+ [attributes addObject:[[[NSSortDescriptor alloc] initWithKey:attributesToSortBy ascending:ascending] autorelease]];
va_end(variadicArguments);
}
@@ -457,7 +476,7 @@ + (NSFetchRequest *)requestAllSortedBy:(NSString *)sortTerm ascending:(BOOL)asce
[request setIncludesSubentities:NO];
[request setFetchBatchSize:[self defaultBatchSize]];
- if (sortTerm != nil){
+ if (sortTerm != nil) {
NSSortDescriptor *sortBy = [[NSSortDescriptor alloc] initWithKey:sortTerm ascending:ascending];
[request setSortDescriptors:[NSArray arrayWithObject:sortBy]];
[sortBy release];
@@ -15,7 +15,7 @@ @implementation NSManagedObjectContext (RKAdditions)
- (RKManagedObjectStore *)managedObjectStore
{
- return (RKManagedObjectStore *) objc_getAssociatedObject(self, &NSManagedObject_RKManagedObjectStoreAssociatedKey);
+ return (RKManagedObjectStore *)objc_getAssociatedObject(self, &NSManagedObject_RKManagedObjectStoreAssociatedKey);
}
- (void)setManagedObjectStore:(RKManagedObjectStore *)managedObjectStore
Oops, something went wrong.

0 comments on commit 8d5e315

Please sign in to comment.