forked from Luke-Sikina/picsure-search-refinement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDashboardService.java
42 lines (35 loc) · 1.59 KB
/
DashboardService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package edu.harvard.dbmi.avillach.dictionary.dashboard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class DashboardService {
private final DashboardRepository repository;
private final List<DashboardColumn> columns;
private final boolean bdcHack;
@Autowired
public DashboardService(
DashboardRepository repository, List<DashboardColumn> columns, @Value("${dashboard.enable.bdc_hack}") boolean bdcHack
) {
this.repository = repository;
this.columns = columns;
this.bdcHack = bdcHack;
}
public Dashboard getDashboard() {
if (bdcHack) {
List<Map<String, String>> rows = repository.getHackyBDCRows();
return new Dashboard(hackyBDCColumns, rows);
}
List<Map<String, String>> rows = repository.getRows();
return new Dashboard(columns, rows);
}
private static final List<DashboardColumn> hackyBDCColumns = List.of(
new DashboardColumn("abbreviation", "Abbreviation"), new DashboardColumn("name", "Name"),
new DashboardColumn("study_focus", "Study Focus"), new DashboardColumn("program_name", "Program"),
new DashboardColumn("participants", "Participants"), new DashboardColumn("clinvars", "Clinical Variables"),
new DashboardColumn("samples", "Samples Sequenced"), new DashboardColumn("accession", "Accession"),
new DashboardColumn("additional_info_link", "Study Link")
);
}