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()));
}
}
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);
}
Aggregations