use of org.devgateway.ocds.persistence.mongo.excel.ReleaseExportFile in project oc-explorer by devgateway.
the class ExcelGenerator method getExcelDownload.
/**
* Method that returns a byte array with excel export.
*
* @param filter
* @return
* @throws IOException
*/
@Cacheable
public byte[] getExcelDownload(final YearFilterPagingRequest filter) throws IOException {
PageRequest pageRequest = new PageRequest(filter.getPageNumber(), filter.getPageSize(), Sort.Direction.ASC, "id");
List<Release> releases = mongoTemplate.find(query(getYearDefaultFilterCriteria(filter, MongoConstants.FieldNames.TENDER_PERIOD_START_DATE)).with(pageRequest), Release.class);
ExcelFile releaseExcelFile = new ReleaseExportFile(releases);
Workbook workbook = releaseExcelFile.createWorkbook();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
workbook.write(baos);
byte[] bytes = baos.toByteArray();
return bytes;
}
use of org.devgateway.ocds.persistence.mongo.excel.ReleaseExportFile in project ocvn by devgateway.
the class ExcelGenerator method getExcelDownload.
/**
* Method that returns a byte array with excel export.
*
* @param filter
* @return
* @throws IOException
*/
@Cacheable
public byte[] getExcelDownload(final YearFilterPagingRequest filter) throws IOException {
PageRequest pageRequest = new PageRequest(filter.getPageNumber(), filter.getPageSize(), Sort.Direction.ASC, "id");
List<Release> releases = mongoTemplate.find(query(getYearDefaultFilterCriteria(filter, MongoConstants.FieldNames.TENDER_PERIOD_START_DATE)).with(pageRequest), Release.class);
ExcelFile releaseExcelFile = new ReleaseExportFile(releases);
Workbook workbook = releaseExcelFile.createWorkbook();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
workbook.write(baos);
byte[] bytes = baos.toByteArray();
return bytes;
}
Aggregations