diff --git a/src/main/java/org/hbp/mip/model/Dataset.java b/src/main/java/org/hbp/mip/model/Dataset.java index de3fde2589defe803e32f08974f314d335ce8289..61b5a5316cebdd78d10b4bb63045bffeb4541c35 100644 --- a/src/main/java/org/hbp/mip/model/Dataset.java +++ b/src/main/java/org/hbp/mip/model/Dataset.java @@ -29,6 +29,10 @@ public class Dataset { @CollectionTable(name = "dataset_grouping", joinColumns = @JoinColumn(name = "dataset_code")) private List<String> grouping = new LinkedList<>(); + @ElementCollection(fetch = FetchType.EAGER) + @CollectionTable(name = "dataset_variable", joinColumns = @JoinColumn(name = "dataset_code")) + private List<String> variable = new LinkedList<>(); + @ElementCollection(fetch=FetchType.EAGER) @CollectionTable(name = "dataset_data", joinColumns = @JoinColumn(name = "dataset_code")) private Map<String, LinkedList<Object>> data = new HashMap<>(); @@ -74,6 +78,15 @@ public class Dataset { } + public List<String> getVariable() { + return variable; + } + + public void setVariable(List<String> variable) { + this.variable = variable; + } + + public Map<String, LinkedList<Object>> getData() { return data; } diff --git a/src/main/java/org/hbp/mip/utils/CSVUtil.java b/src/main/java/org/hbp/mip/utils/CSVUtil.java index 804eb8d919c2d9587554a97b3b5f798d40db64b4..35fd05117dfff48e872b020f0bd994c0c3075366 100644 --- a/src/main/java/org/hbp/mip/utils/CSVUtil.java +++ b/src/main/java/org/hbp/mip/utils/CSVUtil.java @@ -30,18 +30,23 @@ public class CSVUtil { Date date = new Date(); List<String> header = new LinkedList<>(); List<String> grouping = new LinkedList<>(); + List<String> variable = new LinkedList<>(); Map<String, LinkedList<Object>> data = new HashMap<>(); List<Variable> covs = new LinkedList<>(); List<Variable> grps = new LinkedList<>(); + List<Variable> vars = new LinkedList<>(); List<Variable> all = new LinkedList<>(); covs.addAll(query.getCovariables()); grps.addAll(query.getGrouping()); + vars.addAll(query.getVariables()); all.addAll(query.getCovariables()); all.addAll(query.getGrouping()); + all.addAll(query.getVariables()); header.addAll(covs.stream().map(Variable::getCode).collect(Collectors.toList())); grouping.addAll(grps.stream().map(Variable::getCode).collect(Collectors.toList())); + variable.addAll(vars.stream().map(Variable::getCode).collect(Collectors.toList())); try { InputStream is = Dataset.class.getClassLoader().getResourceAsStream(filename); @@ -141,6 +146,7 @@ public class CSVUtil { result.setDate(date); result.setHeader(header); result.setGrouping(grouping); + result.setVariable(variable); result.setData(data); return result; diff --git a/src/test/db b/src/test/db index d9f1a5cde43b31469c97c2b5923ce9585685d597..739945912e9eb01419a90ec92d2e76221f7f9da3 160000 --- a/src/test/db +++ b/src/test/db @@ -1 +1 @@ -Subproject commit d9f1a5cde43b31469c97c2b5923ce9585685d597 +Subproject commit 739945912e9eb01419a90ec92d2e76221f7f9da3