use of org.obiba.mica.dataset.search.rest.harmonization.ExcelContingencyWriter in project mica2 by obiba.
the class PublishedCollectedDatasetVariableResource method getContingencyExcel.
@GET
@Path("/contingency/_export")
@Produces("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
@Timed
public Response getContingencyExcel(@QueryParam("by") String crossVariable) throws IOException {
Pair<DatasetVariable, DatasetVariable> variables = getContingencyVariables(crossVariable);
ByteArrayOutputStream res = new ExcelContingencyWriter(variables.getFirst(), variables.getSecond()).write(getContingencyDto(variables.getFirst(), variables.getSecond()));
return Response.ok(res.toByteArray()).header("Content-Disposition", String.format("attachment; filename=\"contingency-table-%s-%s.xlsx\"", variableName, crossVariable)).build();
}
Aggregations