Skip to content
Snippets Groups Projects
Commit 356dc3ac authored by juanf's avatar juanf
Browse files

Renamed Nexus search function instead commenting it out.

SVN: 35139
parent f448b64a
No related branches found
No related tags found
No related merge requests found
...@@ -749,55 +749,58 @@ def searchSamples(tr, parameters, tableBuilder, sessionId): ...@@ -749,55 +749,58 @@ def searchSamples(tr, parameters, tableBuilder, sessionId):
def searchSamplesCustom(tr, parameters, tableBuilder, v3, criterion, fetchOptions): def searchSamplesCustom(tr, parameters, tableBuilder, v3, criterion, fetchOptions):
return []; return [];
# toReturnPermIds = []; # #return searchSamplesNexus(tr, parameters, tableBuilder, v3, criterion, fetchOptions);
# #Right Givers: The sample with all his descendants
# #1. Request user search with all right givers def searchSamplesNexus(tr, parameters, tableBuilder, v3, criterion, fetchOptions):
# descendantsFetchOptions = SampleFetchOptions(); toReturnPermIds = []; #
# descendantsFetchOptions.withChildrenUsing(descendantsFetchOptions); #Right Givers: The sample with all his descendants
# requestedResults = v3.searchSamples(tr.getOpenBisServiceSessionToken(), criterion, descendantsFetchOptions); #1. Request user search with all right givers
# descendantsFetchOptions = SampleFetchOptions();
# if requestedResults.getTotalCount() > 0: descendantsFetchOptions.withChildrenUsing(descendantsFetchOptions);
# #Prepare data structures for the rights givers to accelerate the process requestedResults = v3.searchSamples(tr.getOpenBisServiceSessionToken(), criterion, descendantsFetchOptions);
# requestedToRigthsGivers = {};
# allRightsGivers = set(); if requestedResults.getTotalCount() > 0:
# for requestedResult in requestedResults.getObjects(): #Prepare data structures for the rights givers to accelerate the process
# rigthsGivers = getDescendantsTreePermIdsStringSet([requestedResult]); requestedToRigthsGivers = {};
# allRightsGivers = allRightsGivers | rigthsGivers; allRightsGivers = set();
# requestedToRigthsGivers[requestedResult.getPermId().getPermId()] = rigthsGivers; for requestedResult in requestedResults.getObjects():
# rigthsGivers = getDescendantsTreePermIdsStringSet([requestedResult]);
# #2. Search for the visible right givers allRightsGivers = allRightsGivers | rigthsGivers;
# requestedToRigthsGivers[requestedResult.getPermId().getPermId()] = rigthsGivers;
# visibleRightGivers = v3.mapSamples(parameters.get("sessionToken"), getSamplePermIdsObjFromPermIdStrings(allRightsGivers), SampleFetchOptions());
# visibleRightGiversPermIds = getDescendantsTreePermIdsStringSet(visibleRightGivers.values()); #2. Search for the visible right givers
# #3. Intersect what the user wants and is available to see and keep matches
# for requestedResultPermIdString in requestedToRigthsGivers: visibleRightGivers = v3.mapSamples(parameters.get("sessionToken"), getSamplePermIdsObjFromPermIdStrings(allRightsGivers), SampleFetchOptions());
# rigthsGiversPermIds = requestedToRigthsGivers[requestedResultPermIdString]; visibleRightGiversPermIds = getDescendantsTreePermIdsStringSet(visibleRightGivers.values());
# intersection = rigthsGiversPermIds & visibleRightGiversPermIds; #3. Intersect what the user wants and is available to see and keep matches
# if len(intersection) > 0: for requestedResultPermIdString in requestedToRigthsGivers:
# toReturnPermIds.append(SamplePermId(requestedResultPermIdString)); rigthsGiversPermIds = requestedToRigthsGivers[requestedResultPermIdString];
# intersection = rigthsGiversPermIds & visibleRightGiversPermIds;
# #Now we complete those permIds with all information available for them using a search by the ETL server if len(intersection) > 0:
# systemResultAsMap = v3.mapSamples(tr.getOpenBisServiceSessionToken(), toReturnPermIds, fetchOptions); toReturnPermIds.append(SamplePermId(requestedResultPermIdString));
# systemResult = ArrayList(systemResultAsMap.values());
# systemSearchResult = SearchResult(systemResult, systemResult.size()); #Now we complete those permIds with all information available for them using a search by the ETL server
# systemResultAsMap = v3.mapSamples(tr.getOpenBisServiceSessionToken(), toReturnPermIds, fetchOptions);
# return systemSearchResult systemResult = ArrayList(systemResultAsMap.values());
# systemSearchResult = SearchResult(systemResult, systemResult.size());
# def getSamplePermIdsObjFromPermIdStrings(samplePermIds):
# values = []; return systemSearchResult
# for samplePermId in samplePermIds:
# values.append(SamplePermId(samplePermId)); def getSamplePermIdsObjFromPermIdStrings(samplePermIds):
# return values; values = [];
# for samplePermId in samplePermIds:
# def getDescendantsTreePermIdsStringSet(samples): values.append(SamplePermId(samplePermId));
# descendantsPermIds = set(); return values;
# for sample in samples:
# descendantsQueue = [sample]; def getDescendantsTreePermIdsStringSet(samples):
# while len(descendantsQueue) > 0: descendantsPermIds = set();
# queueSample = descendantsQueue.pop(); for sample in samples:
# if queueSample.getPermId().getPermId() not in descendantsPermIds: descendantsQueue = [sample];
# descendantsPermIds.add(queueSample.getPermId().getPermId()); while len(descendantsQueue) > 0:
# if queueSample.getFetchOptions().hasChildren(): queueSample = descendantsQueue.pop();
# for child in queueSample.getChildren(): if queueSample.getPermId().getPermId() not in descendantsPermIds:
# descendantsQueue.append(child); descendantsPermIds.add(queueSample.getPermId().getPermId());
# return descendantsPermIds; if queueSample.getFetchOptions().hasChildren():
\ No newline at end of file for child in queueSample.getChildren():
descendantsQueue.append(child);
return descendantsPermIds;
\ No newline at end of file
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