Search in sources :

Example 51 with DefaultResultModel

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

the class IdmMessageDtoUnitTest method testMergeParameters.

@Test
public void testMergeParameters() {
    ResultModel model = new DefaultResultModel(CoreResultCode.INTERNAL_SERVER_ERROR, ImmutableMap.of("one", "one", "two", "two"));
    IdmMessageDto message = new IdmMessageDto.Builder().setModel(model).addParameter("one", "OneUpdated").addParameter("three", "three").build();
    Assert.assertEquals("OneUpdated", message.getParameters().get("one"));
    Assert.assertEquals("two", message.getParameters().get("two"));
    Assert.assertEquals("three", message.getParameters().get("three"));
}
Also used : DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) IdmMessageDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmMessageDto) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) ResultModel(eu.bcvsolutions.idm.core.api.dto.ResultModel) AbstractUnitTest(eu.bcvsolutions.idm.test.api.AbstractUnitTest) Test(org.junit.Test)

Example 52 with DefaultResultModel

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

the class RoleRequestCheckSystemStateProcessor method process.

@Override
public EventResult<IdmRoleRequestDto> process(EntityEvent<IdmRoleRequestDto> event) {
    IdmRoleRequestDto request = event.getContent();
    IdmRoleRequestDto currentRequest = event.getOriginalSource();
    Assert.notNull(request, "Request is required.");
    Assert.notNull(request.getId(), "Request identifier is required.");
    SysProvisioningOperationFilter provisioningOperationFilter = new SysProvisioningOperationFilter();
    provisioningOperationFilter.setRoleRequestId(request.getId());
    // Some active operation for that request has state CREATED -> we will wait for execution of all operations!
    provisioningOperationFilter.setResultState(OperationState.CREATED);
    long countCreatedOperations = provisioningOperationService.count(provisioningOperationFilter);
    if (countCreatedOperations > 0) {
        request.setSystemState(new OperationResultDto(OperationState.RUNNING));
        DefaultEventResult<IdmRoleRequestDto> result = new DefaultEventResult<>(event, this);
        result.getEvent().getProperties().put(SYSTEM_STATE_RESOLVED_KEY, Boolean.TRUE);
        return result;
    }
    provisioningOperationFilter.setResultState(null);
    long countOperations = provisioningOperationService.count(provisioningOperationFilter);
    long countArchives = provisioningArchiveService.count(provisioningOperationFilter);
    long allOperations = countOperations + countArchives;
    // Everything was done (in provisioning)
    if (countOperations == 0 && countArchives > 0) {
        List<IdmConceptRoleRequestDto> concepts = null;
        List<SysProvisioningArchiveDto> canceledOperations = Lists.newArrayList();
        // We want to mark canceled (archives with exception state) concepts
        canceledOperations.addAll(findCanceledArchiveOperations(request, OperationState.EXCEPTION));
        // We want to mark canceled (archives with blocked state) concepts
        canceledOperations.addAll(findCanceledArchiveOperations(request, OperationState.BLOCKED));
        // We want to mark canceled (archives with not executed state) concepts
        canceledOperations.addAll(findCanceledArchiveOperations(request, OperationState.NOT_EXECUTED));
        if (canceledOperations.size() > 0) {
            concepts = loadConcepts(request, concepts);
            Set<SysSystemDto> systems = canceledOperations.stream().map(archive -> {
                return provisioningArchiveService.getSystem(archive);
            }).distinct().collect(Collectors.toSet());
            for (SysSystemDto system : systems) {
                List<IdmConceptRoleRequestDto> canceledConcepts = roleSystemService.getConceptsForSystem(concepts, system.getId());
                // This concepts should have system-state set to CANCELED
                // 
                canceledConcepts.stream().filter(concept -> !(concept.getSystemState() != null && // 
                OperationState.CANCELED == concept.getSystemState().getState())).forEach(concept -> {
                    // 
                    OperationResultDto systemResult = new OperationResultDto.Builder(OperationState.CANCELED).setModel(new DefaultResultModel(AccResultCode.ROLE_REQUEST_OPERATION_CANCELED, ImmutableMap.of("system", system.getCode()))).build();
                    concept.setSystemState(systemResult);
                    // Save role concept
                    conceptRoleRequestService.save(concept);
                });
            }
        }
        // Change state for all concepts with exception to null
        OperationResultDto beforeSystemState = currentRequest.getSystemState();
        if (beforeSystemState != null && OperationState.EXCEPTION == beforeSystemState.getState() && (AccResultCode.ROLE_REQUEST_ALL_OPERATIONS_FAILED.getCode().equals(beforeSystemState.getCode()) || AccResultCode.ROLE_REQUEST_OPERATION_FAILED.getCode().equals(beforeSystemState.getCode()) || AccResultCode.ROLE_REQUEST_SOME_OPERATIONS_FAILED.getCode().equals(beforeSystemState.getCode()))) {
            // Now is request executed (without exceptions), we will set all concepts with
            // exception to null
            concepts = loadConcepts(request, concepts);
            // Find concepts with provisioning exception and set them system state to null
            concepts.stream().filter(concept -> concept.getSystemState() != null && OperationState.EXCEPTION == concept.getSystemState().getState() && AccResultCode.ROLE_REQUEST_OPERATION_FAILED.getCode().equals(concept.getSystemState().getCode())).forEach(concept -> {
                concept.setSystemState(null);
                // Save role concept
                conceptRoleRequestService.save(concept);
            });
        }
        request.setSystemState(new OperationResultDto(OperationState.EXECUTED));
        return new DefaultEventResult<>(event, this);
    }
    // Nothing was done
    if (countOperations == 0 && countArchives == 0) {
        request.setSystemState(null);
        DefaultEventResult<IdmRoleRequestDto> result = new DefaultEventResult<>(event, this);
        result.getEvent().getProperties().put(SYSTEM_STATE_RESOLVED_KEY, Boolean.TRUE);
        return result;
    }
    provisioningOperationFilter.setResultState(OperationState.EXCEPTION);
    long countFailedOperations = provisioningOperationService.count(provisioningOperationFilter);
    if (countFailedOperations == allOperations) {
        // All operations failed
        return createResult(// 
        event, // 
        request, // 
        OperationState.EXCEPTION, // 
        AccResultCode.ROLE_REQUEST_ALL_OPERATIONS_FAILED, // 
        ImmutableMap.of("requestId", request.getId()), null);
    } else if (countFailedOperations > 0) {
        // Some operations failed
        List<SysProvisioningOperationDto> failedOperations = provisioningOperationService.find(provisioningOperationFilter, null).getContent();
        List<IdmConceptRoleRequestDto> concepts = loadConcepts(request, null);
        failedOperations.forEach(operation -> {
            Assert.notNull(operation.getSystem(), "System is required.");
            UUID systemId = operation.getSystem();
            List<IdmConceptRoleRequestDto> failedConcepts = roleSystemService.getConceptsForSystem(concepts, systemId);
            failedConcepts.forEach(concept -> {
                OperationResultDto systemResult = new OperationResultDto.Builder(OperationState.EXCEPTION).setModel(new DefaultResultModel(AccResultCode.ROLE_REQUEST_OPERATION_FAILED, ImmutableMap.of("system", provisioningOperationService.getSystem(operation).getCode()))).build();
                concept.setSystemState(systemResult);
                // Save role concept
                conceptRoleRequestService.save(concept);
            });
        });
        String failedSystems = getSystems(failedOperations);
        if (failedOperations.size() == 1) {
            // Exist only one failed operation -> we can add exception
            return createResult(// 
            event, // 
            request, // 
            OperationState.EXCEPTION, // 
            AccResultCode.ROLE_REQUEST_OPERATION_FAILED, // 
            ImmutableMap.of("system", failedSystems), failedOperations.get(0).getResult().getCause());
        } else {
            return createResult(// 
            event, // 
            request, // 
            OperationState.EXCEPTION, // 
            AccResultCode.ROLE_REQUEST_SOME_OPERATIONS_FAILED, // 
            ImmutableMap.of("systems", failedSystems), null);
        }
    }
    provisioningOperationFilter.setResultState(OperationState.BLOCKED);
    long countBlockedOperations = provisioningOperationService.count(provisioningOperationFilter);
    if (countBlockedOperations > 0) {
        // Some operations are blocked
        List<SysProvisioningOperationDto> blockedOperations = provisioningOperationService.find(provisioningOperationFilter, null).getContent();
        String blockedSystems = getSystems(blockedOperations);
        return createResult(// 
        event, // 
        request, // 
        OperationState.BLOCKED, // 
        AccResultCode.ROLE_REQUEST_SOME_OPERATIONS_BLOCKED, // 
        ImmutableMap.of("systems", blockedSystems), null);
    }
    // Some operations are not-executed
    provisioningOperationFilter.setResultState(OperationState.NOT_EXECUTED);
    long countNotExecutedOperations = provisioningOperationService.count(provisioningOperationFilter);
    if (countNotExecutedOperations > 0) {
        request.setSystemState(new OperationResultDto(OperationState.NOT_EXECUTED));
        DefaultEventResult<IdmRoleRequestDto> result = new DefaultEventResult<>(event, this);
        result.getEvent().getProperties().put(SYSTEM_STATE_RESOLVED_KEY, Boolean.TRUE);
        return result;
    }
    // Some operation are running
    provisioningOperationFilter.setResultState(OperationState.RUNNING);
    long countRunningOperations = provisioningOperationService.count(provisioningOperationFilter);
    if (countRunningOperations > 0) {
        request.setSystemState(new OperationResultDto(OperationState.RUNNING));
        DefaultEventResult<IdmRoleRequestDto> result = new DefaultEventResult<>(event, this);
        result.getEvent().getProperties().put(SYSTEM_STATE_RESOLVED_KEY, Boolean.TRUE);
        return result;
    }
    return new DefaultEventResult<>(event, this);
}
Also used : RoleRequestProcessor(eu.bcvsolutions.idm.core.api.event.processor.RoleRequestProcessor) IdmConceptRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmConceptRoleRequestService) ResultCode(eu.bcvsolutions.idm.core.api.domain.ResultCode) Autowired(org.springframework.beans.factory.annotation.Autowired) CoreEventProcessor(eu.bcvsolutions.idm.core.api.event.CoreEventProcessor) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) IdmRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService) Lists(com.google.common.collect.Lists) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) Map(java.util.Map) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) EventResult(eu.bcvsolutions.idm.core.api.event.EventResult) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) Description(org.springframework.context.annotation.Description) AccModuleDescriptor(eu.bcvsolutions.idm.acc.AccModuleDescriptor) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) ImmutableMap(com.google.common.collect.ImmutableMap) SysProvisioningOperationService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningOperationService) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) Set(java.util.Set) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) RoleRequestState(eu.bcvsolutions.idm.core.api.domain.RoleRequestState) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) List(java.util.List) Component(org.springframework.stereotype.Component) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) RoleRequestEventType(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent.RoleRequestEventType) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) Assert(org.springframework.util.Assert) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) List(java.util.List) UUID(java.util.UUID) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)

Example 53 with DefaultResultModel

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

the class NotificationTemplateDeleteBulkAction method prevalidate.

@Override
public ResultModels prevalidate() {
    IdmBulkActionDto action = getAction();
    List<UUID> entities = getEntities(action, new StringBuilder());
    ResultModels results = new ResultModels();
    IdmNotificationTemplateFilter templateFilter = new IdmNotificationTemplateFilter();
    templateFilter.setUnmodifiable(Boolean.TRUE);
    List<IdmNotificationTemplateDto> unmodifiable = notificationService.find(templateFilter, null).getContent();
    List<IdmNotificationTemplateDto> templatesToWarn = unmodifiable.stream().filter(dto -> {
        return entities.contains(dto.getId());
    }).collect(Collectors.toList());
    for (IdmNotificationTemplateDto item : templatesToWarn) {
        results.addInfo(new DefaultResultModel(CoreResultCode.NOTIFICATION_SYSTEM_TEMPLATE_DELETE_FAILED, ImmutableMap.of("template", item.getCode())));
    }
    return results;
}
Also used : Description(org.springframework.context.annotation.Description) AbstractRemoveBulkAction(eu.bcvsolutions.idm.core.api.bulk.action.AbstractRemoveBulkAction) ResultModels(eu.bcvsolutions.idm.core.api.dto.ResultModels) NotificationGroupPermission(eu.bcvsolutions.idm.core.notification.domain.NotificationGroupPermission) ImmutableMap(com.google.common.collect.ImmutableMap) ReadWriteDtoService(eu.bcvsolutions.idm.core.api.service.ReadWriteDtoService) Autowired(org.springframework.beans.factory.annotation.Autowired) UUID(java.util.UUID) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) Collectors(java.util.stream.Collectors) IdmNotificationTemplateFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationTemplateFilter) List(java.util.List) Component(org.springframework.stereotype.Component) Lists(com.google.common.collect.Lists) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) IdmNotificationTemplateService(eu.bcvsolutions.idm.core.notification.api.service.IdmNotificationTemplateService) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) IdmNotificationTemplateFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationTemplateFilter) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) UUID(java.util.UUID) IdmNotificationTemplateDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto) ResultModels(eu.bcvsolutions.idm.core.api.dto.ResultModels)

Example 54 with DefaultResultModel

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

the class RoleDeleteBulkAction method prevalidate.

@Override
public ResultModels prevalidate() {
    IdmBulkActionDto action = getAction();
    List<UUID> entities = getEntities(action, new StringBuilder());
    ResultModels result = new ResultModels();
    Map<ResultModel, Long> models = new HashMap<>();
    entities.forEach(roleId -> {
        IdmIdentityRoleFilter identityRoleFilter = new IdmIdentityRoleFilter();
        identityRoleFilter.setRoleId(roleId);
        IdmRoleDto role = getService().get(roleId);
        long count = identityRoleService.count(identityRoleFilter);
        if (count > 0) {
            if (securityService.hasAnyAuthority(CoreGroupPermission.ROLE_ADMIN)) {
                models.put(new DefaultResultModel(CoreResultCode.ROLE_FORCE_DELETE_BULK_ACTION_NUMBER_OF_IDENTITIES, ImmutableMap.of("role", role.getCode(), "count", count)), count);
            } else {
                models.put(new DefaultResultModel(CoreResultCode.ROLE_DELETE_BULK_ACTION_NUMBER_OF_IDENTITIES, ImmutableMap.of("role", role.getCode(), "count", count)), count);
            }
        }
    });
    long conceptsToModify = // 
    entities.stream().map(roleId -> {
        IdmConceptRoleRequestFilter roleRequestFilter = new IdmConceptRoleRequestFilter();
        roleRequestFilter.setRoleId(roleId);
        return conceptRoleRequestService.count(roleRequestFilter);
    }).reduce(0L, Long::sum);
    ResultModel conceptCountResult = null;
    if (conceptsToModify > 0) {
        conceptCountResult = new DefaultResultModel(CoreResultCode.ROLE_DELETE_BULK_ACTION_CONCEPTS_TO_MODIFY, ImmutableMap.of("conceptCount", conceptsToModify));
    }
    // Sort by count
    List<Entry<ResultModel, Long>> collect = // 
    models.entrySet().stream().sorted(// 
    Collections.reverseOrder(Map.Entry.comparingByValue())).limit(// 
    5).collect(// 
    Collectors.toList());
    collect.forEach(entry -> {
        result.addInfo(entry.getKey());
    });
    if (conceptCountResult != null) {
        result.addInfo(conceptCountResult);
    }
    return result;
}
Also used : AbstractRemoveBulkAction(eu.bcvsolutions.idm.core.api.bulk.action.AbstractRemoveBulkAction) ResultModels(eu.bcvsolutions.idm.core.api.dto.ResultModels) IdmConceptRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmConceptRoleRequestService) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) EntityEventProcessor(eu.bcvsolutions.idm.core.api.event.EntityEventProcessor) StringUtils(org.apache.commons.lang3.StringUtils) RoleEvent(eu.bcvsolutions.idm.core.model.event.RoleEvent) SecurityService(eu.bcvsolutions.idm.core.security.api.service.SecurityService) ArrayList(java.util.ArrayList) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) HashSet(java.util.HashSet) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) EntityStateManager(eu.bcvsolutions.idm.core.api.service.EntityStateManager) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Lists(com.google.common.collect.Lists) OperationResult(eu.bcvsolutions.idm.core.api.entity.OperationResult) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) Map(java.util.Map) RoleEventType(eu.bcvsolutions.idm.core.model.event.RoleEvent.RoleEventType) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) Description(org.springframework.context.annotation.Description) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) ImmutableMap(com.google.common.collect.ImmutableMap) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) ReadWriteDtoService(eu.bcvsolutions.idm.core.api.service.ReadWriteDtoService) Set(java.util.Set) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) EventContext(eu.bcvsolutions.idm.core.api.event.EventContext) PriorityType(eu.bcvsolutions.idm.core.api.domain.PriorityType) ConfigurationMap(eu.bcvsolutions.idm.core.api.domain.ConfigurationMap) List(java.util.List) Component(org.springframework.stereotype.Component) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) ExceptionUtils(eu.bcvsolutions.idm.core.api.utils.ExceptionUtils) Entry(java.util.Map.Entry) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) Collections(java.util.Collections) ResultModel(eu.bcvsolutions.idm.core.api.dto.ResultModel) IdmConceptRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmConceptRoleRequestFilter) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) HashMap(java.util.HashMap) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) ResultModel(eu.bcvsolutions.idm.core.api.dto.ResultModel) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) ResultModels(eu.bcvsolutions.idm.core.api.dto.ResultModels) IdmConceptRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmConceptRoleRequestFilter) Entry(java.util.Map.Entry) UUID(java.util.UUID)

Example 55 with DefaultResultModel

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

the class IdentityChangeContractGuaranteeBulkAction method prevalidate.

/**
 * If no guarantee for selected identities exists,
 * return the info in the result model.
 */
@Override
public ResultModels prevalidate() {
    ResultModels result = new ResultModels();
    IdmBulkActionDto action = getAction();
    try {
        List<UUID> guarantees = getContractGuaranteeIdentities(action);
        if (guarantees.isEmpty()) {
            result.addInfo(new DefaultResultModel(CoreResultCode.BULK_ACTION_NO_CONTRACT_GUARANTEE_EXISTS));
        }
        if (guarantees.size() > 45) {
            // this is because during autocomplete all IDs are put into the URL
            // which has a max length of 2048
            // the user will be shown all identities without the added filtering
            result.addInfo(new DefaultResultModel(CoreResultCode.BULK_ACTION_TOO_MANY_CONTRACT_GUARANTEE_EXIST));
        }
    } catch (FilterSizeExceededException e) {
        result.addInfo(new DefaultResultModel(CoreResultCode.BULK_ACTION_TOO_MANY_USERS_SELECTED, Map.of("maximum", e.getMaximum())));
    }
    return result;
}
Also used : FilterSizeExceededException(eu.bcvsolutions.idm.core.api.exception.FilterSizeExceededException) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) UUID(java.util.UUID) ResultModels(eu.bcvsolutions.idm.core.api.dto.ResultModels)

Aggregations

DefaultResultModel (eu.bcvsolutions.idm.core.api.dto.DefaultResultModel)104 ResultModel (eu.bcvsolutions.idm.core.api.dto.ResultModel)52 UUID (java.util.UUID)48 OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)40 OperationResult (eu.bcvsolutions.idm.core.api.entity.OperationResult)35 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)25 IdmEntityStateDto (eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto)24 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)21 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)19 HashMap (java.util.HashMap)19 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)18 OperationState (eu.bcvsolutions.idm.core.api.domain.OperationState)16 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)16 Autowired (org.springframework.beans.factory.annotation.Autowired)16 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)15 List (java.util.List)15 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)14 Set (java.util.Set)14 ImmutableMap (com.google.common.collect.ImmutableMap)13 CoreResultCode (eu.bcvsolutions.idm.core.api.domain.CoreResultCode)13