use of eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmScheduledTaskFilter 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