I'm using the Demoiselle and its paging feature, but when I need to use all the objects listed, ie use the full return, it does not leave, it keeps paging.
My pagination:
@Override
public LazyDataModel<NotaFiscal> getDataModel() {
if (dataModel == null) {
dataModel = new LazyDataModel<NotaFiscal>() {
@Override
public List<NotaFiscal> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
Pagination pagination = getPagination();
pagination.setPageSize(pageSize);
pagination.setFirstResult(first);
List<NotaFiscal> itemsList = handleResultList();
dataModel.setRowCount(pagination.getTotalResults());
return itemsList;
}
};
}
return dataModel;
}
At this point I need to use the complete result, and it ends up getting only what is on the first page:
public void downloadAllPDFs() {
List<NotaFiscal> lista = handleResultList();
if (lista == null || lista.isEmpty()) {
//TODO - colocar mensagem
return;
}
List<File> files = new ArrayList<File>();
for (NotaFiscal nf : lista) {
try {
NotaFiscal nota = this.notaFiscalBC.load(nf.getId());
NotaFiscalTO notaTO = NotaFiscalToTO.geraNotaFiscalTO(nota);
extraiPDF(files, notaTO);
} catch (Exception ex) {
CriareLog.log(ex);
getMessageContext().add(getResourceBundle().getString("msg.download.erro"), SeverityType.ERROR);
return;
}
}
preparaDownloadPDF(files);
}
I would like to know if there is a way to remove the pagination to use all the result obtained?
Thank you