diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/dashboarddrawer/DashboardDrawerService.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/dashboarddrawer/DashboardDrawerService.java index be701c3..e804cd9 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/dashboarddrawer/DashboardDrawerService.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/dashboarddrawer/DashboardDrawerService.java @@ -39,12 +39,16 @@ public DashboardDrawerList findAll() { * @param datasetId the ID of the dataset to fetch. * @return a Dashboard instance with drawer-specific columns and rows. */ - public DashboardDrawerList findByDatasetId(Integer datasetId) { + public DashboardDrawer findByDatasetId(Integer datasetId) { if (dashboardLayout.equalsIgnoreCase("bdc")) { List records = repository.getDashboardDrawerRows(datasetId); - return new DashboardDrawerList(records); + // Should be atomic as the query is an aggregation on the dataset table. + // Probably a better way to do this. + if (records.size() == 1) { + return records.get(0); + } } - return new DashboardDrawerList(new ArrayList<>()); + return new DashboardDrawer(-1, "", "", new ArrayList<>(), "", new ArrayList<>(), "", ""); } } \ No newline at end of file