Search in sources :

Example 46 with IdmRoleCompositionDto

use of eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto in project CzechIdMng by bcvsolutions.

the class RemoveRoleCompositionTaskExecutor method validate.

/**
 * Automatic role removal can be start, if previously LRT ended.
 */
@Override
public void validate(IdmLongRunningTaskDto task) {
    super.validate(task);
    // 
    // composition is already deleted
    IdmRoleCompositionDto roleComposition = roleCompositionService.get(roleCompositionId);
    if (roleComposition == null) {
        throw new EntityNotFoundException(IdmRoleComposition.class, roleCompositionId);
    }
    // 
    IdmLongRunningTaskFilter filter = new IdmLongRunningTaskFilter();
    filter.setOperationState(OperationState.RUNNING);
    // ignore waiting tasks
    filter.setRunning(Boolean.TRUE);
    filter.setTaskType(AddNewRoleCompositionTaskExecutor.class.getCanonicalName());
    for (UUID longRunningTaskId : getLongRunningTaskService().findIds(filter, PageRequest.of(0, 1))) {
        throw new AcceptedException(CoreResultCode.ROLE_COMPOSITION_RUN_CONCURRENTLY, ImmutableMap.of("taskId", longRunningTaskId.toString(), "roleCompositionId", roleCompositionId.toString()));
    }
}
Also used : IdmRoleCompositionDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto) IdmLongRunningTaskFilter(eu.bcvsolutions.idm.core.scheduler.api.dto.filter.IdmLongRunningTaskFilter) EntityNotFoundException(eu.bcvsolutions.idm.core.api.exception.EntityNotFoundException) AcceptedException(eu.bcvsolutions.idm.core.api.exception.AcceptedException) UUID(java.util.UUID)

Example 47 with IdmRoleCompositionDto

use of eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto in project CzechIdMng by bcvsolutions.

the class RemoveRoleCompositionTaskExecutor method getItemsToProcess.

/**
 * Returns superior roles, which should be processed
 */
@Override
public Page<IdmIdentityRoleDto> getItemsToProcess(Pageable pageable) {
    IdmRoleCompositionDto roleComposition = roleCompositionService.get(roleCompositionId);
    Assert.notNull(roleComposition, "Role composition is required.");
    // 
    // 
    IdmIdentityRoleFilter filter = new IdmIdentityRoleFilter();
    filter.setRoleCompositionId(roleComposition.getId());
    // 
    return identityRoleService.find(filter, null);
}
Also used : IdmRoleCompositionDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter)

Aggregations

IdmRoleCompositionDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto)47 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)35 Test (org.junit.Test)24 UUID (java.util.UUID)23 List (java.util.List)22 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)21 Autowired (org.springframework.beans.factory.annotation.Autowired)21 IdmRoleCompositionService (eu.bcvsolutions.idm.core.api.service.IdmRoleCompositionService)20 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)19 IdmIdentityRoleService (eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService)18 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)16 Set (java.util.Set)16 IdmRoleService (eu.bcvsolutions.idm.core.api.service.IdmRoleService)15 Assert (org.junit.Assert)15 Transactional (org.springframework.transaction.annotation.Transactional)15 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)14 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)13 IdmIdentityRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter)13 ArrayList (java.util.ArrayList)13 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)12