diff --git a/openbis-ipad/BisKit/Classes/CISDOBIpadService.h b/openbis-ipad/BisKit/Classes/CISDOBIpadService.h index e141706ca0be5c679e968f811a11f34db0f66bf2..86963fff45438e572e358939cd8e4c2a682225f7 100644 --- a/openbis-ipad/BisKit/Classes/CISDOBIpadService.h +++ b/openbis-ipad/BisKit/Classes/CISDOBIpadService.h @@ -52,15 +52,21 @@ enum CISOBIpadServiceErrorCode { //! Log the user into the openBIS instance - (CISDOBAsyncCall *)loginUser:(NSString *)user password:(NSString *)password; -//! Get all root-level entities from the openBIS ipad service, possibly along with some children as well. The success message will be invoked with a collection of CISDOBIpadRawEntity objects. +//! Get all root-level entities from the openBIS ipad service, possibly along with some children as well. The success block will be invoked with a collection of CISDOBIpadRawEntity objects. - (CISDOBAsyncCall *)listRootLevelEntities; -//! Get drill information from the openBIS ipad service -- this will include information about the children of the entity and possibly their children as well. The two collections must have the same cardinality. The success message will be invoked with a collection of CISDOBIpadRawEntity objects. +//! Get drill information from the openBIS ipad service -- this will include information about the children of the entity and possibly their children as well. The permIds and refcons collections must have the same cardinality. The success block will be invoked with a collection of CISDOBIpadRawEntity objects. - (CISDOBAsyncCall *)drillOnEntities:(NSArray *)permIds refcons:(NSArray *)refcons; //! A convenience version of drillOnEntities:refcons: for one entity. - (CISDOBAsyncCall *)drillOnEntityWithPermId:(NSString *)permId refcon:(id)refcon; +//! Get detail information from the openBIS ipad service. The permIds and refcons collections must have the same cardinality. The success block will be invoked with a collection of CISDOBIpadRawEntity objects. +- (CISDOBAsyncCall *)detailsForEntities:(NSArray *)permIds refcons:(NSArray *)refcons; + +//! A convenience version of detailsForEntities:refcons: for one entity. +- (CISDOBAsyncCall *)detailsForEntityWithPermId:(NSString *)permId refcon:(id)refcon; + @end diff --git a/openbis-ipad/BisKit/Classes/CISDOBIpadService.m b/openbis-ipad/BisKit/Classes/CISDOBIpadService.m index 03f6701f502b3a4be8dd6e530c0b698af79b5072..bb6c01c4ce692b00df89d069c777a7234278f6f1 100644 --- a/openbis-ipad/BisKit/Classes/CISDOBIpadService.m +++ b/openbis-ipad/BisKit/Classes/CISDOBIpadService.m @@ -157,13 +157,13 @@ NSString *const CISDOBIpadServiceErrorDomain = @"CISDOBIpadServiceErrorDomain"; return iPadCall; } -- (CISDOBAsyncCall *)listRootLevelEntities; +- (CISDOBIpadServiceCall *)createIpadServiceCallWithParameters:(NSDictionary *)parameters { - NSDictionary *parameters = [NSDictionary dictionaryWithObject: @"ROOT" forKey: @"requestKey"]; - CISDOBAsyncCall *connectionCall = [_connection - createReportFromDataStore: [_ipadReadService objectForKey: @"dataStoreCode"] - aggregationService: [_ipadReadService objectForKey: @"serviceKey"] - parameters: parameters]; + CISDOBAsyncCall *connectionCall = + [_connection + createReportFromDataStore: [_ipadReadService objectForKey: @"dataStoreCode"] + aggregationService: [_ipadReadService objectForKey: @"serviceKey"] + parameters: parameters]; CISDOBIpadServiceCall *iPadCall = [self iPadCallWrappingConnectionCall: connectionCall]; connectionCall.success = ^(id result) { @@ -171,41 +171,40 @@ NSString *const CISDOBIpadServiceErrorDomain = @"CISDOBIpadServiceErrorDomain"; iPadCall.success([self rawEntitiesFromResult: result]); } }; - return iPadCall; } -- (CISDOBAsyncCall *)drillOnEntities:(NSArray *)permIds refcons:(NSArray *)refcons +- (CISDOBAsyncCall *)listRootLevelEntities; +{ + NSDictionary *parameters = [NSDictionary dictionaryWithObject: @"ROOT" forKey: @"requestKey"]; + return [self createIpadServiceCallWithParameters: parameters]; +} + +- (NSMutableArray *)convertToEntitiesPermIds:(NSArray *)permIds refcons:(NSArray *)refcons count:(NSUInteger)count { - NSUInteger count = [permIds count]; - NSAssert([refcons count] == count, @"Drilling requires permIds and refcons. There must be an equal number of these."); NSMutableArray *entities = [[NSMutableArray alloc] initWithCapacity: [permIds count]]; for (NSUInteger i = 0; i < count; ++i) { NSDictionary *entity = - [NSDictionary dictionaryWithObjectsAndKeys: - [permIds objectAtIndex: i], @"PERM_ID", - [refcons objectAtIndex: i], @"REFCON", nil]; + [NSDictionary dictionaryWithObjectsAndKeys: + [permIds objectAtIndex: i], @"PERM_ID", + [refcons objectAtIndex: i], @"REFCON", nil]; [entities addObject: entity]; } + return entities; +} + +- (CISDOBAsyncCall *)drillOnEntities:(NSArray *)permIds refcons:(NSArray *)refcons +{ + NSUInteger count = [permIds count]; + NSAssert([refcons count] == count, @"Drilling requires permIds and refcons. There must be an equal number of these."); + NSMutableArray *entities; + entities = [self convertToEntitiesPermIds: permIds refcons: refcons count: count]; NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys: @"DRILL", @"requestKey", entities, @"entities", nil]; - CISDOBAsyncCall *connectionCall = - [_connection - createReportFromDataStore: [_ipadReadService objectForKey: @"dataStoreCode"] - aggregationService: [_ipadReadService objectForKey: @"serviceKey"] - parameters: parameters]; - CISDOBIpadServiceCall *iPadCall = [self iPadCallWrappingConnectionCall: connectionCall]; - - connectionCall.success = ^(id result) { - if (iPadCall.success) { - iPadCall.success([self rawEntitiesFromResult: result]); - } - }; - - return iPadCall; + return [self createIpadServiceCallWithParameters: parameters]; } - (CISDOBAsyncCall *)drillOnEntityWithPermId:(NSString *)permId refcon:(id)refcon @@ -215,6 +214,27 @@ NSString *const CISDOBIpadServiceErrorDomain = @"CISDOBIpadServiceErrorDomain"; return [self drillOnEntities: permIds refcons: refcons]; } +- (CISDOBAsyncCall *)detailsForEntities:(NSArray *)permIds refcons:(NSArray *)refcons +{ + NSUInteger count = [permIds count]; + NSAssert([refcons count] == count, @"Drilling requires permIds and refcons. There must be an equal number of these."); + NSMutableArray *entities; + entities = [self convertToEntitiesPermIds: permIds refcons: refcons count: count]; + + NSDictionary *parameters = + [NSDictionary dictionaryWithObjectsAndKeys: + @"DETAIL", @"requestKey", + entities, @"entities", nil]; + return [self createIpadServiceCallWithParameters: parameters]; +} + +- (CISDOBAsyncCall *)detailsForEntityWithPermId:(NSString *)permId refcon:(id)refcon +{ + NSArray *permIds = [NSArray arrayWithObject: permId]; + NSArray *refcons = [NSArray arrayWithObject: refcon]; + return [self detailsForEntities: permIds refcons: refcons]; +} + @end @implementation CISDOBIpadServiceCall 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 7837fda048c7430ec7f40075db8719c3fd2fc6b8..06d062fcffe376eb04eb5b14acd4f0621ba5d062 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