use of org.springframework.data.domain.Pageable in project goci by EBISPOT.
the class SolrIndexer method mapTraits.
Integer mapTraits() {
Sort sort = new Sort(new Sort.Order("trait"));
Pageable pager = new PageRequest(0, pageSize, sort);
Page<DiseaseTrait> diseaseTraitPage = diseaseTraitRepository.findAll(pager);
traitMapper.map(diseaseTraitPage.getContent());
while (diseaseTraitPage.hasNext()) {
if (maxPages != -1 && diseaseTraitPage.getNumber() >= maxPages - 1) {
break;
}
pager = pager.next();
diseaseTraitPage = diseaseTraitRepository.findAll(pager);
traitMapper.map(diseaseTraitPage.getContent());
if (sysOutLogging) {
System.out.print(".");
}
}
return (int) diseaseTraitPage.getTotalElements();
}
use of org.springframework.data.domain.Pageable in project CzechIdMng by bcvsolutions.
the class DefaultWorkflowHistoricProcessInstanceService method search.
/**
* Search process history. Process variables will be included only for get
* specific process history. It means filter.processInstanceId is filled.
*
* @param filter
* @return
*/
@Override
public ResourcesWrapper<WorkflowHistoricProcessInstanceDto> search(WorkflowFilterDto filter) {
Pageable pageable = null;
// get pageable setting from filter - backward compatibility
if (StringUtils.isNotEmpty(filter.getSortByFields())) {
Sort sort = null;
if (filter.isSortAsc()) {
sort = new Sort(Direction.ASC, filter.getSortByFields());
} else {
sort = new Sort(Direction.DESC, filter.getSortByFields());
}
pageable = new PageRequest(filter.getPageNumber(), filter.getPageSize(), sort);
} else {
pageable = new PageRequest(filter.getPageNumber(), filter.getPageSize());
}
Page<WorkflowHistoricProcessInstanceDto> page = this.find(filter, pageable);
return new ResourcesWrapper<>(page.getContent(), page.getTotalElements(), page.getTotalPages(), filter.getPageNumber(), filter.getPageSize());
}
use of org.springframework.data.domain.Pageable in project CzechIdMng by bcvsolutions.
the class DefaultWorkflowHistoricTaskInstanceService method search.
@Override
public ResourcesWrapper<WorkflowHistoricTaskInstanceDto> search(WorkflowFilterDto filter) {
Pageable pageable = null;
// get pageable setting from filter - backward compatibility
if (StringUtils.isNotEmpty(filter.getSortByFields())) {
Sort sort = null;
if (filter.isSortAsc()) {
sort = new Sort(Direction.ASC, filter.getSortByFields());
} else {
sort = new Sort(Direction.DESC, filter.getSortByFields());
}
pageable = new PageRequest(filter.getPageNumber(), filter.getPageSize(), sort);
} else {
pageable = new PageRequest(filter.getPageNumber(), filter.getPageSize());
}
Page<WorkflowHistoricTaskInstanceDto> page = this.find(filter, pageable);
return new ResourcesWrapper<>(page.getContent(), page.getTotalElements(), page.getTotalPages(), filter.getPageNumber(), filter.getPageSize());
}
use of org.springframework.data.domain.Pageable in project CzechIdMng by bcvsolutions.
the class DefaultAuditServiceTest method auditQuickSearch.
@Test
public void auditQuickSearch() {
IdmAuditFilter filter = new IdmAuditFilter();
filter.setModifier("admin");
filter.setType(IdmRole.class.getSimpleName());
Pageable pageable = new PageRequest(0, 10);
List<IdmAuditDto> result = auditService.find(filter, pageable).getContent();
for (IdmAuditDto idmAudit : result) {
assertEquals("admin", idmAudit.getModifier());
assertEquals(IdmRole.class.getName(), idmAudit.getType());
}
}
use of org.springframework.data.domain.Pageable in project judge by zjnu-acm.
the class Pageables method buggy.
private Pageable buggy() {
Sort.Order order = new Sort.Order(Sort.Direction.DESC, "dummy");
ArrayList<Sort.Order> list = new ArrayList<>(1);
list.add(order);
Pageable pageable = new PageRequest(0, 50, new Sort(list));
list.clear();
return pageable;
}
Aggregations