From b15fc09beff203a81d622c49707a175ce75a92bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20T=C3=A1rraga=20Gim=C3=A9nez?= Date: Thu, 25 Jan 2024 21:36:15 +0100 Subject: [PATCH 1/2] catalog: fix clinical analysis creation, #TASK-5538, #TASK-5516 --- .../managers/ClinicalAnalysisManager.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManager.java index 351ff17a184..5fb26ec5367 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManager.java @@ -342,14 +342,20 @@ public OpenCGAResult create(String studyStr, ClinicalAnalysis // Validate users Set userIds = new HashSet<>(); for (ClinicalAnalyst analyst : clinicalAnalysis.getAnalysts()) { - userIds.add(analyst.getId()); + if (StringUtils.isNotEmpty(analyst.getId())) { + userIds.add(analyst.getId()); + } } - Query query = new Query(UserDBAdaptor.QueryParams.ID.key(), userIds); - OpenCGAResult result = userDBAdaptor.get(query, userInclude); - if (result.getNumResults() < userIds.size()) { - throw new CatalogException("Some clinical analysts could not be found."); + if (CollectionUtils.isNotEmpty(userIds)) { + Query query = new Query(UserDBAdaptor.QueryParams.ID.key(), userIds); + OpenCGAResult result = userDBAdaptor.get(query, userInclude); + if (result.getNumResults() < userIds.size()) { + throw new CatalogException("Some clinical analysts could not be found."); + } + userList = result.getResults(); + } else { + userList = userDBAdaptor.get(userId, userInclude).getResults(); } - userList = result.getResults(); } List clinicalAnalystList = new ArrayList<>(userList.size()); for (User user : userList) { @@ -663,7 +669,7 @@ public ClinicalAnalysisLoadResult load(String studyStr, Path filePath, String to counter++; } catch (Exception e) { logger.error("Error loading clinical analysis" + (clinicalAnalysis != null ? (": " + clinicalAnalysis.getId()) : "") - + ": " + e.getMessage()); + + ": " + e.getMessage()); result.getFailures().put(clinicalAnalysis.getId(), e.getMessage()); } } @@ -2328,8 +2334,8 @@ public OpenCGAResult groupBy(@Nullable String studyStr, Query query, List updateAnnotations(String studyStr, String clinicalStr, String annotationSetId, - Map annotations, ParamUtils.CompleteUpdateAction action, - QueryOptions options, String token) throws CatalogException { + Map annotations, ParamUtils.CompleteUpdateAction action, + QueryOptions options, String token) throws CatalogException { if (annotations == null || annotations.isEmpty()) { throw new CatalogException("Missing array of annotations."); } From 23224a3fafd41d9cdf940518c2c37f7a95552b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20T=C3=A1rraga=20Gim=C3=A9nez?= Date: Thu, 25 Jan 2024 22:03:10 +0100 Subject: [PATCH 2/2] pom: workaround for SonarCloud issue on CI/CD, #TASK-5516 --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index 0de0a7fdc99..8079976c15f 100644 --- a/pom.xml +++ b/pom.xml @@ -147,6 +147,13 @@ 2.5-20081211 2.23.0 + + + true