Skip to content
Snippets Groups Projects
Commit 8dd2a0b3 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

update dataset to send variable field too

parent b41b26a2
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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;
......
db @ 73994591
Subproject commit d9f1a5cde43b31469c97c2b5923ce9585685d597
Subproject commit 739945912e9eb01419a90ec92d2e76221f7f9da3
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment