diff --git a/openbis-ipad/BisKit/Classes/persistent-data-model.xcdatamodeld/persistent-data-model.xcdatamodel/contents b/openbis-ipad/BisKit/Classes/persistent-data-model.xcdatamodeld/persistent-data-model.xcdatamodel/contents index f08a2c87cececb846b03c216c8289bc98f0851a1..b4b2370f4ed2b3bdea0660503584465115cc8798 100644 --- a/openbis-ipad/BisKit/Classes/persistent-data-model.xcdatamodeld/persistent-data-model.xcdatamodel/contents +++ b/openbis-ipad/BisKit/Classes/persistent-data-model.xcdatamodeld/persistent-data-model.xcdatamodel/contents @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1810" systemVersion="11G56" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic"> +<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1811" systemVersion="11G56" minimumToolsVersion="Xcode 4.3" macOSVersion="Automatic" iOSVersion="Automatic"> <entity name="CISDOBIpadEntity" representedClassName="CISDOBIpadEntity" syncable="YES"> <attribute name="childrenPermIds" optional="YES" transient="YES" syncable="YES"/> <attribute name="childrenPermIdsJson" optional="YES" attributeType="String" indexed="YES" syncable="YES"/> @@ -13,7 +13,7 @@ <attribute name="summary" optional="YES" attributeType="String" syncable="YES"/> <attribute name="summaryHeader" optional="YES" attributeType="String" syncable="YES"/> </entity> - <fetchRequest name="PermIdFetch" entity="CISDOBIpadEntity" predicateString="permId in PERM_ID"/> + <fetchRequest name="EntitiesByPermIds" entity="CISDOBIpadEntity" predicateString="permId IN $PERM_IDS" fetchBatchSize="20"/> <elements> <element name="CISDOBIpadEntity" positionX="160" positionY="192" width="128" height="210"/> </elements> diff --git a/openbis-ipad/BisKit/Tests/CISDOBIpadEntityTest.m b/openbis-ipad/BisKit/Tests/CISDOBIpadEntityTest.m index 215e83719a436489cbcbfacf2c32d7a2c804600f..4773ebc669c549c4e1bb396af6bfeb06bdc0e715 100644 --- a/openbis-ipad/BisKit/Tests/CISDOBIpadEntityTest.m +++ b/openbis-ipad/BisKit/Tests/CISDOBIpadEntityTest.m @@ -111,6 +111,26 @@ NSManagedObjectContext* GetDatabaseManagedObjectContext(NSURL* storeURL, NSError STAssertEquals([elements count], count, @"%llu in db != %llu from server", [elements count], count); } +- (void)checkFindingChildren +{ + NSError* error; + NSFetchRequest* request = [[NSFetchRequest alloc] init]; + NSEntityDescription* entity = [NSEntityDescription entityForName: @"CISDOBIpadEntity" inManagedObjectContext: _moc]; + [request setEntity: entity]; + NSArray* allEntities = [_moc executeFetchRequest: request error: &error]; + + NSManagedObjectModel *model = [entity managedObjectModel]; + for (CISDOBIpadEntity *entity in allEntities) { + if ([entity.childrenPermIds count] > 0) { + NSDictionary *fetchVariables = [NSDictionary dictionaryWithObject: entity.childrenPermIds forKey: @"PERM_IDS"]; + request = [model fetchRequestFromTemplateWithName: @"EntitiesByPermIds" substitutionVariables: fetchVariables]; + NSArray *children = [_moc executeFetchRequest: request error: &error]; + STAssertTrue([entity.childrenPermIds count] == [children count], @"Entity children %@ should resolve correctly. Found instead the following %@", entity.childrenPermIds, children); + } + } + +} + - (void)testPersistEntities { CISDOBAsyncCall *call; @@ -127,6 +147,9 @@ NSManagedObjectContext* GetDatabaseManagedObjectContext(NSURL* storeURL, NSError // Check that the cardnality is equal [self checkEntityCardnalityEquals: [_callResult count]]; + + // Check that the children could be found + [self checkFindingChildren]; } @end diff --git a/openbis-ipad/Research/BisMac.xcodeproj/project.pbxproj b/openbis-ipad/Research/BisMac.xcodeproj/project.pbxproj index b19d40381e5e0a83b2f636e35b51de7ec91af075..658599a7cd936bf15e3d076677cb9b5bd8b57f8f 100644 --- a/openbis-ipad/Research/BisMac.xcodeproj/project.pbxproj +++ b/openbis-ipad/Research/BisMac.xcodeproj/project.pbxproj @@ -228,8 +228,8 @@ 36F71E541619837800C87277 /* JSON-RPC */, 3649C8A815EBB2950019AC55 /* CISDOBConnection.h */, 3649C8A915EBB2950019AC55 /* CISDOBConnection.m */, - 3680B1321611B5CE008BA207 /* CISDOBIpadService.h */, 3680B1331611B5CE008BA207 /* CISDOBIpadService.m */, + 3680B1321611B5CE008BA207 /* CISDOBIpadService.h */, 36F71E4A1619829300C87277 /* persistent-data-model.xcdatamodeld */, 36F71E4D1619834600C87277 /* CISDOBIpadEntity.h */, 36F71E4E1619834600C87277 /* CISDOBIpadEntity.m */, diff --git a/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate b/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate index 6dff5053f692a7a671321afd787f555928ad93d8..070c80643e794250391abfbf6943e513af08e9e1 100644 Binary files a/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate and b/openbis-ipad/Research/BisMac.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate b/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate index 9261d51fcf9f3ee213e8be9704a8071395f7fc87..e43897e02c1446c33bdd241035ba712e98591e3d 100644 Binary files a/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate and b/openbis-ipad/openBIS/openBIS.xcodeproj/project.xcworkspace/xcuserdata/cramakri.xcuserdatad/UserInterfaceState.xcuserstate differ