use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmProcessedTaskItemService method findQueueItems.
@Override
@Transactional(readOnly = true)
public Page<IdmProcessedTaskItemDto> findQueueItems(IdmScheduledTaskDto scheduledTask, Pageable pageable) {
Assert.notNull(scheduledTask);
//
IdmProcessedTaskItemFilter f = new IdmProcessedTaskItemFilter();
f.setScheduledTaskId(scheduledTask.getId());
return this.find(f, pageable);
}
use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter in project CzechIdMng by bcvsolutions.
the class AbstractSchedulableStatefulExecutor method getItemFromQueue.
private Page<IdmProcessedTaskItemDto> getItemFromQueue(UUID entityRef) {
// TODO: this is probably not good idea, but for now it is only choice
if (this.getScheduledTaskId() == null) {
return new PageImpl<>(Collections.emptyList());
}
IdmProcessedTaskItemFilter filter = new IdmProcessedTaskItemFilter();
filter.setReferencedEntityId(entityRef);
filter.setScheduledTaskId(this.getScheduledTaskId());
Page<IdmProcessedTaskItemDto> p = itemService.find(filter, new PageRequest(0, 1));
if (p.getTotalElements() > 1) {
LOG.warn("Multiple same item references found in [{}] process queue.", this.getClass());
}
return p;
}
use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmProcessedTaskItemService method findLogItems.
@Override
@Transactional(readOnly = true)
public Page<IdmProcessedTaskItemDto> findLogItems(IdmLongRunningTaskDto longRunningTask, Pageable pageable) {
Assert.notNull(longRunningTask);
//
IdmProcessedTaskItemFilter f = new IdmProcessedTaskItemFilter();
f.setLongRunningTaskId(longRunningTask.getId());
return this.find(f, pageable);
}
use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmProcessedTaskItemDtoServiceTest method datesFilter.
@Test
public void datesFilter() {
IdmScheduledTaskDto d = helper.createSchedulableTask();
IdmProcessedTaskItemDto item = service.saveInternal(helper.prepareProcessedItem(d));
IdmProcessedTaskItemDto item2 = helper.prepareProcessedItem(d);
item2.setCreated(item.getCreated());
item2 = service.saveInternal(item2);
//
IdmProcessedTaskItemDto item3 = service.saveInternal(helper.prepareProcessedItem(d));
//
IdmProcessedTaskItemFilter filter = new IdmProcessedTaskItemFilter();
filter.setFrom(item.getCreated());
Page<IdmProcessedTaskItemDto> result = service.find(filter, null);
assertTrue("#1", result.getContent().contains(item));
assertTrue("#2", result.getContent().contains(item2));
filter.setFrom(null);
filter.setTill(item3.getCreated());
result = service.find(filter, null);
assertTrue("#4", result.getContent().contains(item3));
}
use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter in project CzechIdMng by bcvsolutions.
the class DefaultIdmProcessedTaskItemDtoServiceTest method textFilter.
@Test
public void textFilter() {
// find number of all processed items in old tests
IdmProcessedTaskItemFilter filter = new IdmProcessedTaskItemFilter();
filter.setText(IdmIdentityDto.class.getCanonicalName());
Page<IdmProcessedTaskItemDto> result = service.find(filter, null);
long count = result.getTotalElements();
//
IdmScheduledTaskDto d = helper.createSchedulableTask();
IdmProcessedTaskItemDto item = service.saveInternal(helper.prepareProcessedItem(d));
IdmProcessedTaskItemDto item2 = service.saveInternal(helper.prepareProcessedItem(d));
//
filter.setText(item.getReferencedDtoType());
result = service.find(filter, null);
assertEquals("Wrong number of items!", 2 + count, result.getTotalElements());
assertTrue(result.getContent().contains(item));
assertTrue(result.getContent().contains(item2));
}
Aggregations