Search in sources :

Example 1 with SpreadSheetFormat

use of uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.SpreadSheetFormat in project miso-lims by miso-lims.

the class MisoWebUtils method generateSpreadsheet.

public static <T> HttpEntity<byte[]> generateSpreadsheet(SpreadsheetRequest request, Stream<T> input, boolean detailedSample, Function<String, Spreadsheet<T>> formatLibrary, HttpServletResponse response) {
    Spreadsheet<T> spreadsheet = formatLibrary.apply(request.getSheet());
    SpreadSheetFormat formatter = SpreadSheetFormat.valueOf(request.getFormat());
    HttpHeaders headers = makeHttpHeaders(spreadsheet, formatter, response);
    return new HttpEntity<>(formatter.generate(input, detailedSample, spreadsheet), headers);
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) HttpEntity(org.springframework.http.HttpEntity) SpreadSheetFormat(uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.SpreadSheetFormat)

Aggregations

HttpEntity (org.springframework.http.HttpEntity)1 HttpHeaders (org.springframework.http.HttpHeaders)1 SpreadSheetFormat (uk.ac.bbsrc.tgac.miso.core.data.spreadsheet.SpreadSheetFormat)1