use of eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessAutomaticRoleByTreeTaskExecutor in project CzechIdMng by bcvsolutions.
the class RoleTreeNodeSaveProcessor method process.
@Override
public EventResult<IdmRoleTreeNodeDto> process(EntityEvent<IdmRoleTreeNodeDto> event) {
IdmRoleTreeNodeDto dto = event.getContent();
//
dto = service.saveInternal(dto);
event.setContent(dto);
// assign role by this added automatic role to all existing identity contracts with long running task
try {
ProcessAutomaticRoleByTreeTaskExecutor automaticRoleTask = AutowireHelper.createBean(ProcessAutomaticRoleByTreeTaskExecutor.class);
automaticRoleTask.setAutomaticRoles(Lists.newArrayList(dto.getId()));
executeTask(event, automaticRoleTask);
} catch (AcceptedException ex) {
DefaultEventResult<IdmRoleTreeNodeDto> result = new DefaultEventResult<>(event, this);
result.setSuspended(true);
//
return result;
}
//
return new DefaultEventResult<>(event, this);
}
use of eu.bcvsolutions.idm.core.scheduler.task.impl.ProcessAutomaticRoleByTreeTaskExecutor in project CzechIdMng by bcvsolutions.
the class DefaultIdmContractPositionServiceIntegrationTest method saveAutomaticRole.
private IdmRoleTreeNodeDto saveAutomaticRole(IdmRoleTreeNodeDto automaticRole, boolean withLongRunningTask) {
// default name
automaticRole.setName("default");
IdmRoleTreeNodeDto roleTreeNode = roleTreeNodeService.saveInternal(automaticRole);
//
if (withLongRunningTask) {
ProcessAutomaticRoleByTreeTaskExecutor task = new ProcessAutomaticRoleByTreeTaskExecutor();
task.setAutomaticRoles(Lists.newArrayList(roleTreeNode.getId()));
taskManager.executeSync(task);
}
//
return roleTreeNodeService.get(roleTreeNode.getId());
}
Aggregations