Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
356dc3ac
Commit
356dc3ac
authored
9 years ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
Renamed Nexus search function instead commenting it out.
SVN: 35139
parent
f448b64a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plasmid/source/core-plugins/eln-lims/1/dss/reporting-plugins/newbrowserapi/script.py
+55
-52
55 additions, 52 deletions
.../eln-lims/1/dss/reporting-plugins/newbrowserapi/script.py
with
55 additions
and
52 deletions
plasmid/source/core-plugins/eln-lims/1/dss/reporting-plugins/newbrowserapi/script.py
+
55
−
52
View file @
356dc3ac
...
...
@@ -749,55 +749,58 @@ def searchSamples(tr, parameters, tableBuilder, sessionId):
def
searchSamplesCustom
(
tr
,
parameters
,
tableBuilder
,
v3
,
criterion
,
fetchOptions
):
return
[];
# toReturnPermIds = []; #
# #Right Givers: The sample with all his descendants
# #1. Request user search with all right givers
# descendantsFetchOptions = SampleFetchOptions();
# descendantsFetchOptions.withChildrenUsing(descendantsFetchOptions);
# requestedResults = v3.searchSamples(tr.getOpenBisServiceSessionToken(), criterion, descendantsFetchOptions);
#
# if requestedResults.getTotalCount() > 0:
# #Prepare data structures for the rights givers to accelerate the process
# requestedToRigthsGivers = {};
# allRightsGivers = set();
# for requestedResult in requestedResults.getObjects():
# rigthsGivers = getDescendantsTreePermIdsStringSet([requestedResult]);
# allRightsGivers = allRightsGivers | rigthsGivers;
# requestedToRigthsGivers[requestedResult.getPermId().getPermId()] = rigthsGivers;
#
# #2. Search for the visible right givers
#
# visibleRightGivers = v3.mapSamples(parameters.get("sessionToken"), getSamplePermIdsObjFromPermIdStrings(allRightsGivers), SampleFetchOptions());
# visibleRightGiversPermIds = getDescendantsTreePermIdsStringSet(visibleRightGivers.values());
# #3. Intersect what the user wants and is available to see and keep matches
# for requestedResultPermIdString in requestedToRigthsGivers:
# rigthsGiversPermIds = requestedToRigthsGivers[requestedResultPermIdString];
# intersection = rigthsGiversPermIds & visibleRightGiversPermIds;
# if len(intersection) > 0:
# toReturnPermIds.append(SamplePermId(requestedResultPermIdString));
#
# #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);
# systemResult = ArrayList(systemResultAsMap.values());
# systemSearchResult = SearchResult(systemResult, systemResult.size());
#
# return systemSearchResult
#
# def getSamplePermIdsObjFromPermIdStrings(samplePermIds):
# values = [];
# for samplePermId in samplePermIds:
# values.append(SamplePermId(samplePermId));
# return values;
#
# def getDescendantsTreePermIdsStringSet(samples):
# descendantsPermIds = set();
# for sample in samples:
# descendantsQueue = [sample];
# while len(descendantsQueue) > 0:
# queueSample = descendantsQueue.pop();
# if queueSample.getPermId().getPermId() not in descendantsPermIds:
# descendantsPermIds.add(queueSample.getPermId().getPermId());
# if queueSample.getFetchOptions().hasChildren():
# for child in queueSample.getChildren():
# descendantsQueue.append(child);
# return descendantsPermIds;
\ No newline at end of file
#return searchSamplesNexus(tr, parameters, tableBuilder, v3, criterion, fetchOptions);
def
searchSamplesNexus
(
tr
,
parameters
,
tableBuilder
,
v3
,
criterion
,
fetchOptions
):
toReturnPermIds
=
[];
#
#Right Givers: The sample with all his descendants
#1. Request user search with all right givers
descendantsFetchOptions
=
SampleFetchOptions
();
descendantsFetchOptions
.
withChildrenUsing
(
descendantsFetchOptions
);
requestedResults
=
v3
.
searchSamples
(
tr
.
getOpenBisServiceSessionToken
(),
criterion
,
descendantsFetchOptions
);
if
requestedResults
.
getTotalCount
()
>
0
:
#Prepare data structures for the rights givers to accelerate the process
requestedToRigthsGivers
=
{};
allRightsGivers
=
set
();
for
requestedResult
in
requestedResults
.
getObjects
():
rigthsGivers
=
getDescendantsTreePermIdsStringSet
([
requestedResult
]);
allRightsGivers
=
allRightsGivers
|
rigthsGivers
;
requestedToRigthsGivers
[
requestedResult
.
getPermId
().
getPermId
()]
=
rigthsGivers
;
#2. Search for the visible right givers
visibleRightGivers
=
v3
.
mapSamples
(
parameters
.
get
(
"
sessionToken
"
),
getSamplePermIdsObjFromPermIdStrings
(
allRightsGivers
),
SampleFetchOptions
());
visibleRightGiversPermIds
=
getDescendantsTreePermIdsStringSet
(
visibleRightGivers
.
values
());
#3. Intersect what the user wants and is available to see and keep matches
for
requestedResultPermIdString
in
requestedToRigthsGivers
:
rigthsGiversPermIds
=
requestedToRigthsGivers
[
requestedResultPermIdString
];
intersection
=
rigthsGiversPermIds
&
visibleRightGiversPermIds
;
if
len
(
intersection
)
>
0
:
toReturnPermIds
.
append
(
SamplePermId
(
requestedResultPermIdString
));
#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
);
systemResult
=
ArrayList
(
systemResultAsMap
.
values
());
systemSearchResult
=
SearchResult
(
systemResult
,
systemResult
.
size
());
return
systemSearchResult
def
getSamplePermIdsObjFromPermIdStrings
(
samplePermIds
):
values
=
[];
for
samplePermId
in
samplePermIds
:
values
.
append
(
SamplePermId
(
samplePermId
));
return
values
;
def
getDescendantsTreePermIdsStringSet
(
samples
):
descendantsPermIds
=
set
();
for
sample
in
samples
:
descendantsQueue
=
[
sample
];
while
len
(
descendantsQueue
)
>
0
:
queueSample
=
descendantsQueue
.
pop
();
if
queueSample
.
getPermId
().
getPermId
()
not
in
descendantsPermIds
:
descendantsPermIds
.
add
(
queueSample
.
getPermId
().
getPermId
());
if
queueSample
.
getFetchOptions
().
hasChildren
():
for
child
in
queueSample
.
getChildren
():
descendantsQueue
.
append
(
child
);
return
descendantsPermIds
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment