Skip to content

Commit

Permalink
Ensure empty string is returned in place of null
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcolon021 committed Nov 13, 2024
1 parent e5dff93 commit 21743ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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
);

Expand Down

0 comments on commit 21743ac

Please sign in to comment.