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
9297e1b2
Commit
9297e1b2
authored
1 year ago
by
piotr.kupczyk@id.ethz.ch
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-14065 : UsageReportingTask fails with NPE if samples without space were created
parent
7ac87b80
No related branches found
Branches containing commit
Tags
before-problems
Tags containing commit
1 merge request
!54
20.10.10.1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/UsageGatherer.java
+19
-13
19 additions, 13 deletions
...temsx/cisd/openbis/generic/server/task/UsageGatherer.java
with
19 additions
and
13 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/UsageGatherer.java
+
19
−
13
View file @
9297e1b2
/*
* Copyright 2018
ETH Zuerich, SIS
* Copyright
ETH
2018
- 2023 Zürich, Scientific IT Services
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
ch.systemsx.cisd.openbis.generic.server.task
;
import
java.util.List
;
...
...
@@ -132,7 +131,7 @@ public class UsageGatherer
fetchOptions
.
withSpace
();
fetchOptions
.
withRegistrator
();
List
<
Sample
>
samples
=
service
.
searchSamples
(
sessionToken
,
searchCriteria
,
fetchOptions
).
getObjects
();
Function
<
Sample
,
String
>
spaceExtractor
=
sample
->
sample
.
getSpace
().
getCode
();
Function
<
Sample
,
String
>
spaceExtractor
=
sample
->
sample
.
getSpace
()
!=
null
?
sample
.
getSpace
().
getCode
()
:
null
;
gatherUsage
(
usageByUsersAndSpaces
,
samples
,
spaceExtractor
,
UsageInfo:
:
addNewSample
);
}
...
...
@@ -148,18 +147,25 @@ public class UsageGatherer
experimentFetchOptions
.
withProject
().
withSpace
();
List
<
DataSet
>
dataSets
=
service
.
searchDataSets
(
sessionToken
,
searchCriteria
,
fetchOptions
).
getObjects
();
Function
<
DataSet
,
String
>
spaceExtractor
=
new
Function
<
DataSet
,
String
>()
{
@Override
public
String
apply
(
DataSet
dataSet
)
{
@Override
public
String
apply
(
DataSet
dataSet
)
Experiment
experiment
=
dataSet
.
getExperiment
();
if
(
experiment
!=
null
)
{
Experiment
experiment
=
dataSet
.
getExperiment
();
if
(
experiment
!=
null
)
{
return
experiment
.
getProject
().
getSpace
().
getCode
();
}
return
dataSet
.
getSample
().
getSpace
().
getCode
();
return
experiment
.
getProject
().
getSpace
().
getCode
();
}
Sample
sample
=
dataSet
.
getSample
();
if
(
sample
!=
null
)
{
return
sample
.
getSpace
()
!=
null
?
sample
.
getSpace
().
getCode
()
:
null
;
}
};
return
null
;
}
};
gatherUsage
(
usageByUsersAndSpaces
,
dataSets
,
spaceExtractor
,
UsageInfo:
:
addNewDataSet
);
}
...
...
@@ -173,7 +179,7 @@ public class UsageGatherer
if
(
usageBySpaces
!=
null
)
{
String
space
=
spaceExtractor
.
apply
(
entity
);
if
(
spacesToBeIgnored
.
contains
(
space
)
==
false
)
if
(
space
!=
null
&&
spacesToBeIgnored
.
contains
(
space
)
==
false
)
{
UsageInfo
usageInfo
=
usageBySpaces
.
get
(
space
);
if
(
usageInfo
==
null
)
...
...
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