use of org.springframework.data.domain.PageRequest in project ignite by apache.
the class IgniteSpringDataQueriesSelfTest method testSliceOfLists.
/**
*/
public void testSliceOfLists() {
Slice<List> lists = repo2.querySliceOfList("^[a-z]+$", new PageRequest(0, 3));
assertEquals(3, lists.getSize());
for (List list : lists) {
assertEquals(2, list.size());
assertTrue(list.get(0) instanceof Integer);
}
}
use of org.springframework.data.domain.PageRequest in project CzechIdMng by bcvsolutions.
the class RetryProvisioningTaskExecutor method process.
@Override
public Boolean process() {
LOG.info("Retry provisioning executor starts for all next attmepts old than [{}]", start);
counter = 0L;
boolean canContinue = true;
while (canContinue) {
// we process all batches
Page<SysProvisioningBatchDto> batches = provisioningBatchService.findBatchesToRetry(start, new PageRequest(0, 100));
// init count
if (count == null) {
count = batches.getTotalElements();
}
//
for (SysProvisioningBatchDto batch : batches) {
try {
provisioningExecutor.execute(batch);
counter++;
canContinue = updateState();
} catch (Exception ex) {
// TODO: stateful task executor with item reselt state
LOG.error("Batch [{}] execution failed", batch.getId(), ex);
}
if (!canContinue) {
break;
}
}
if (!batches.hasNext()) {
break;
}
}
LOG.info("Retry provisioning executor ended for all next attempts old than [{}]", start);
return Boolean.TRUE;
}
use of org.springframework.data.domain.PageRequest 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.PageRequest 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.PageRequest in project CzechIdMng by bcvsolutions.
the class DefaultIdmScheduledTaskService method findByQuartzTaskName.
@Transactional(readOnly = true)
@Override
public IdmScheduledTaskDto findByQuartzTaskName(String taskName) {
IdmScheduledTaskFilter filter = new IdmScheduledTaskFilter();
filter.setQuartzTaskName(taskName);
Page<IdmScheduledTaskDto> results = find(filter, new PageRequest(0, 1));
if (results.getTotalElements() == 0) {
return null;
} else if (results.getTotalElements() == 1) {
return results.iterator().next();
}
throw new SchedulerException(CoreResultCode.SEARCH_ERROR, ImmutableMap.of("reason", "Multiple tasks found for " + getClass().getSimpleName() + " task."));
}
Aggregations