Search in sources :

Example 1 with DatasetVariableCsvReportGenerator

use of org.obiba.mica.search.reports.generators.DatasetVariableCsvReportGenerator in project mica2 by obiba.

the class PublishedDatasetVariablesSetResource method reportVariables.

@GET
@Path("/documents/_report")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response reportVariables(@PathParam("id") String id, @QueryParam("locale") @DefaultValue("en") String locale) {
    DocumentSet documentSet = getSecuredDocumentSet(id);
    ReportGenerator reporter = new DatasetVariableCsvReportGenerator(variableSetService.getVariables(documentSet, false), locale);
    StreamingOutput stream = reporter::write;
    return Response.ok(stream).header("Content-Disposition", "attachment; filename=\"Variables.zip\"").build();
}
Also used : DatasetVariableCsvReportGenerator(org.obiba.mica.search.reports.generators.DatasetVariableCsvReportGenerator) DatasetVariableCsvReportGenerator(org.obiba.mica.search.reports.generators.DatasetVariableCsvReportGenerator) ReportGenerator(org.obiba.mica.search.reports.ReportGenerator) StreamingOutput(javax.ws.rs.core.StreamingOutput) DocumentSet(org.obiba.mica.core.domain.DocumentSet)

Aggregations

StreamingOutput (javax.ws.rs.core.StreamingOutput)1 DocumentSet (org.obiba.mica.core.domain.DocumentSet)1 ReportGenerator (org.obiba.mica.search.reports.ReportGenerator)1 DatasetVariableCsvReportGenerator (org.obiba.mica.search.reports.generators.DatasetVariableCsvReportGenerator)1