From 21743aca652854b652d563c48697dc054fe06dfb Mon Sep 17 00:00:00 2001 From: GeorgeC Date: Wed, 13 Nov 2024 10:13:16 -0500 Subject: [PATCH] Ensure empty string is returned in place of null --- .../dictionary/legacysearch/LegacySearchQueryMapper.java | 3 +++ .../dictionary/legacysearch/SearchResultRowMapper.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/legacysearch/LegacySearchQueryMapper.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/legacysearch/LegacySearchQueryMapper.java index ba555f2..fed16a3 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/legacysearch/LegacySearchQueryMapper.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/legacysearch/LegacySearchQueryMapper.java @@ -4,6 +4,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import edu.harvard.dbmi.avillach.dictionary.filter.Filter; import edu.harvard.dbmi.avillach.dictionary.legacysearch.model.LegacySearchQuery; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.data.domain.PageRequest; import java.io.IOException; @@ -12,6 +14,7 @@ public class LegacySearchQueryMapper { private static final ObjectMapper objectMapper = new ObjectMapper(); + private static final Logger log = LoggerFactory.getLogger(LegacySearchQueryMapper.class); public static LegacySearchQuery mapFromJson(String jsonString) throws IOException { JsonNode rootNode = objectMapper.readTree(jsonString); diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/legacysearch/SearchResultRowMapper.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/legacysearch/SearchResultRowMapper.java index 1ec7c21..c356e1d 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/legacysearch/SearchResultRowMapper.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/legacysearch/SearchResultRowMapper.java @@ -45,7 +45,7 @@ private SearchResult mapSearchResults(ResultSet rs) throws SQLException { rs.getString("stigmatized"), rs.getString("display"), rs.getString("description"), isContinuous ? String.valueOf(jsonBlobParser.parseMin(rs.getString("values"))) : "", rs.getString("conceptPath"), rs.getString("parentName"), rs.getString("conceptPath"), rs.getString("name"), rs.getString("parentDisplay"), - rs.getString("description"), // changed from display to description + rs.getString("description") == null || rs.getString("description").isBlank() ? "" : rs.getString(""), // changed "{}", "", rs.getString("parentDisplay"), isContinuous ? String.valueOf(jsonBlobParser.parseMax(rs.getString("values"))) : "", rs.getString("description"), rs.getString("dataset"), hashedVarId, rs.getString("conceptType"), rs.getString("name"), rs.getString("dataset"), rs.getString("stigmatized"), rs.getString("display"), rs.getString("studyAcronym"), @@ -54,7 +54,7 @@ private SearchResult mapSearchResults(ResultSet rs) throws SQLException { Result result = new Result( metadata, jsonBlobParser.parseValues(rs.getString("values")), rs.getString("dataset"), - rs.getString("parentName") != null && rs.getString("parentName").isBlank() ? "All Variables" : rs.getString("parentName"), + rs.getString("parentName") == null || rs.getString("parentName").isBlank() ? "All Variables" : rs.getString("parentName"), rs.getString("name"), "categorical".equalsIgnoreCase(rs.getString("conceptType")), isContinuous );