query static reference

This commit is contained in:
amentis 2024-04-25 15:00:32 +03:00
parent a1c95f35fd
commit ea3b1a762d
1 changed files with 12 additions and 10 deletions

View File

@ -117,24 +117,26 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
if (this.conventionService.isListNullOrEmpty(item.getOptions())) continue;
Map<String, String> result = new HashMap<>();
Map<String, Object> 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 (!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;
}