Skip to content
Snippets Groups Projects
Commit 7ced3f45 authored by cramakri's avatar cramakri
Browse files

Switched to treating the REFCON as JSON.

SVN: 27276
parent d35b71a7
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,7 @@ enum CISOBIpadServiceErrorCode {
- (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 success message will be invoked with a collection of CISDOBIpadRawEntity objects.
- (CISDOBAsyncCall *)drillOnEntityWithPermId:(NSString *)permId refcon:(NSString *)refcon;
- (CISDOBAsyncCall *)drillOnEntityWithPermId:(NSString *)permId refcon:(id)refcon;
@end
......
......@@ -175,7 +175,7 @@ NSString *const CISDOBIpadServiceErrorDomain = @"CISDOBIpadServiceErrorDomain";
return iPadCall;
}
- (CISDOBAsyncCall *)drillOnEntityWithPermId:(NSString *)permId refcon:(NSString *)refcon
- (CISDOBAsyncCall *)drillOnEntityWithPermId:(NSString *)permId refcon:(id)refcon
{
// A simple version of the method that just request data for one entity.
NSDictionary *entity =
......
......@@ -105,7 +105,10 @@
}
// Drill
call = [_service drillOnEntityWithPermId: entityWithChildren.permId refcon: entityWithChildren.refcon];
NSError *error;
id refconObject = [NSJSONSerialization JSONObjectWithData: [entityWithChildren.refcon dataUsingEncoding: NSASCIIStringEncoding] options: 0 error: &error];
STAssertNotNil(refconObject, @"Could not parse refcon string %@ : %@", entityWithChildren.refcon, error);
call = [_service drillOnEntityWithPermId: entityWithChildren.permId refcon: refconObject];
[self configureAndRunCallSynchronously: call];
rawEntities = _callResult;
......
......@@ -66,9 +66,9 @@ The iPad data model tracks information for displaying and navigating between ent
</tr>
<tr>
<td>REFCON</td>
<td>Data that is passed unchanged back to the server when a row is modified. This can be used by the server to encode whatever it needs in order to modify the row.</td>
<td>Data that is passed unchanged back to the server when a row is modified. This can be used by the server to encode whatever it needs in order to modify the row. Transmitted as JSON.</td>
<td>For server use only; transmitted to the server on every call that it is appropriate.</td>
<td>openBIS entity kind + type + permId</td>
<td>E.g., {code : [code], entityKind : [entity kind], entityType : [entity type], permId : [permId]}</td>
</tr>
<tr>
<td>CATEGORY</td>
......
......@@ -11,10 +11,6 @@ def json_encoded_value(coll):
"""Utility function for converting a list into a json-encoded list"""
return ObjectMapper().writeValueAsString(coll)
def json_string_to_dict(string):
"""Utility function for converting a json-encoded dictionary into a Java/Jython dictionary."""
return ObjectMapper().readValue(string, dict)
class RequestHandler:
"""Abstract superclass for the handlers for concrete requests like ROOT.
......@@ -207,7 +203,7 @@ def samples_to_dict(samples, material_by_perm_id):
def retrieve_samples(sample_perm_ids_and_ref_cons):
sc = SearchCriteria()
for sample in sample_perm_ids_and_ref_cons:
code = json_string_to_dict(sample['REFCON'])['code']
code = sample['REFCON']['code']
sc.addMatchClause(sc.MatchClause.createAttributeMatch(sc.MatchClauseAttribute.CODE, code))
return searchService.searchForSamples(sc)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment