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):
...
@@ -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
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