Search in sources :

Example 1 with AddNewAutomaticRoleTaskExecutor

use of eu.bcvsolutions.idm.core.scheduler.task.impl.AddNewAutomaticRoleTaskExecutor in project CzechIdMng by bcvsolutions.

the class DefaultIdmIdentityContractServiceIntegrationTest method saveAutomaticRole.

/**
 * Save automatic role with repository and manual create and wait for task
 * @param automaticRole
 * @return
 */
private IdmRoleTreeNodeDto saveAutomaticRole(IdmRoleTreeNodeDto automaticRole, boolean withLongRunningTask) {
    // default name
    automaticRole.setName("default");
    IdmRoleTreeNodeDto roleTreeNode = roleTreeNodeService.saveInternal(automaticRole);
    // 
    if (withLongRunningTask) {
        AddNewAutomaticRoleTaskExecutor task = new AddNewAutomaticRoleTaskExecutor();
        task.setAutomaticRoleId(roleTreeNode.getId());
        taskManager.executeSync(task);
    }
    // 
    return roleTreeNodeService.get(roleTreeNode.getId());
}
Also used : AddNewAutomaticRoleTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.AddNewAutomaticRoleTaskExecutor) IdmRoleTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleTreeNodeDto)

Example 2 with AddNewAutomaticRoleTaskExecutor

use of eu.bcvsolutions.idm.core.scheduler.task.impl.AddNewAutomaticRoleTaskExecutor 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
    AddNewAutomaticRoleTaskExecutor automaticRoleTask = AutowireHelper.createBean(AddNewAutomaticRoleTaskExecutor.class);
    automaticRoleTask.setAutomaticRoleId(dto.getId());
    longRunningTaskManager.execute(automaticRoleTask);
    return new DefaultEventResult<>(event, this);
}
Also used : AddNewAutomaticRoleTaskExecutor(eu.bcvsolutions.idm.core.scheduler.task.impl.AddNewAutomaticRoleTaskExecutor) IdmRoleTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleTreeNodeDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult)

Aggregations

IdmRoleTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleTreeNodeDto)2 AddNewAutomaticRoleTaskExecutor (eu.bcvsolutions.idm.core.scheduler.task.impl.AddNewAutomaticRoleTaskExecutor)2 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)1