From ea3b1a762d7b5a046658541bf91affbb4c48abc1 Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 25 Apr 2024 15:00:32 +0300 Subject: [PATCH] query static reference --- .../ExternalFetcherServiceImpl.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java index a11793f8f..4e91f8648 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/externalfetcher/ExternalFetcherServiceImpl.java @@ -117,23 +117,25 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService { if (this.conventionService.isListNullOrEmpty(item.getOptions())) continue; Map result = new HashMap<>(); Map rawData = new HashMap<>(); + for (Object object: item.getOptions()) { StaticOptionEntity staticOption = (StaticOptionEntity) object; - if (this.conventionService.isNullOrEmpty(externalReferenceCriteria.getLike())){ rawData.put(staticOption.getCode(), staticOption.getValue()); result.put(staticOption.getCode(), staticOption.getValue()); result.put(ReferenceEntity.KnownFields.SourceLabel, staticSource.getLabel()); result.put(ReferenceEntity.KnownFields.Key, staticSource.getKey()); - }else if (!this.conventionService.isNullOrEmpty(externalReferenceCriteria.getLike()) && externalReferenceCriteria.getLike().toUpperCase().contains(staticOption.getValue().toUpperCase())){ - rawData.put(staticOption.getCode(), staticOption.getValue()); - result.put(staticOption.getCode(), staticOption.getValue()); - result.put(ReferenceEntity.KnownFields.SourceLabel, staticSource.getLabel()); - result.put(ReferenceEntity.KnownFields.Key, staticSource.getKey()); - } - } - if (!rawData.isEmpty()) externalDataResult.getRawData().add(rawData); - if (!result.isEmpty()) externalDataResult.getResults().add(result); + if (!this.conventionService.isNullOrEmpty(externalReferenceCriteria.getLike())) { + if ( (result.get(ReferenceEntity.KnownFields.ReferenceId) != null && result.get(ReferenceEntity.KnownFields.ReferenceId).toUpperCase().contains(externalReferenceCriteria.getLike().toUpperCase())) + || (result.get(ReferenceEntity.KnownFields.Label) != null && result.get(ReferenceEntity.KnownFields.Label).toUpperCase().contains(externalReferenceCriteria.getLike().toUpperCase())) + || (result.get(ReferenceEntity.KnownFields.Description) != null && result.get(ReferenceEntity.KnownFields.Description).toUpperCase().contains(externalReferenceCriteria.getLike().toUpperCase()))) { + if (!rawData.isEmpty()) externalDataResult.getRawData().add(rawData); + if (!result.isEmpty()) externalDataResult.getResults().add(result); + } + } else{ + if (!rawData.isEmpty()) externalDataResult.getRawData().add(rawData); + if (!result.isEmpty()) externalDataResult.getResults().add(result); + } } return externalDataResult;