use of org.apache.isis.applib.annotation.CommandPersistence in project estatio by estatio.
the class PaymentBatchManager method downloadExcelExportForCompletedBatches.
@Action(semantics = SemanticsOf.SAFE, commandPersistence = CommandPersistence.NOT_PERSISTED, publishing = Publishing.DISABLED)
public Blob downloadExcelExportForCompletedBatches(@Nullable final String documentName, final LocalDate startExecutionDate, final LocalDate endExecutionDate) {
List<PaymentLineForExcelExportV1> lineVms = new ArrayList<>();
List<PaymentBatch> batchesToExport = getCompletedBatches().stream().filter(x -> x.getRequestedExecutionDate().toLocalDate().isAfter(startExecutionDate.minusDays(1)) && x.getRequestedExecutionDate().toLocalDate().isBefore(endExecutionDate.plusDays(1))).collect(Collectors.toList());
for (PaymentBatch batch : batchesToExport) {
lineVms.addAll(batch.paymentLinesForExcelExport());
}
String name = documentName != null ? documentName.concat(".xlsx") : "export.xlsx";
return excelService.toExcel(lineVms, PaymentLineForExcelExportV1.class, "export", name);
}
Aggregations