Search in sources :

Example 1 with IdmProcessedTaskItemFilter

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);
}
Also used : IdmProcessedTaskItemFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with IdmProcessedTaskItemFilter

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;
}
Also used : PageImpl(org.springframework.data.domain.PageImpl) PageRequest(org.springframework.data.domain.PageRequest) IdmProcessedTaskItemFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto)

Example 3 with IdmProcessedTaskItemFilter

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);
}
Also used : IdmProcessedTaskItemFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with IdmProcessedTaskItemFilter

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));
}
Also used : IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) IdmProcessedTaskItemFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 5 with IdmProcessedTaskItemFilter

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));
}
Also used : IdmScheduledTaskDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto) IdmProcessedTaskItemFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter) IdmProcessedTaskItemDto(eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmProcessedTaskItemFilter (eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmProcessedTaskItemFilter)9 IdmProcessedTaskItemDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmProcessedTaskItemDto)7 IdmScheduledTaskDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmScheduledTaskDto)6 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)6 Test (org.junit.Test)6 Transactional (org.springframework.transaction.annotation.Transactional)2 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)1 IdmLongRunningTaskDto (eu.bcvsolutions.idm.core.scheduler.api.dto.IdmLongRunningTaskDto)1 PageImpl (org.springframework.data.domain.PageImpl)1 PageRequest (org.springframework.data.domain.PageRequest)1