Search in sources :

Example 1 with IdmConceptRoleRequest_

use of eu.bcvsolutions.idm.core.model.entity.IdmConceptRoleRequest_ in project CzechIdMng by bcvsolutions.

the class DefaultIdmRequestIdentityRoleService method save.

@Override
@Transactional
public IdmRequestIdentityRoleDto save(IdmRequestIdentityRoleDto dto, BasePermission... permission) {
    LOG.debug(MessageFormat.format("Save idm-request-identity-role [{0}] ", dto));
    Assert.notNull(dto, "DTO is required.");
    // We don`t know if is given DTO identity-role or role-concept.
    if (dto.getId() != null && dto.getId().equals(dto.getIdentityRole())) {
        // Given DTO is identity-role -> create UPDATE concept
        IdmIdentityRoleDto identityRole = identityRoleService.get(dto.getId());
        Assert.notNull(identityRole, "Identity role is required.");
        IdmIdentityContractDto identityContractDto = DtoUtils.getEmbedded(identityRole, IdmIdentityRole_.identityContract.getName(), IdmIdentityContractDto.class);
        UUID requestId = dto.getRoleRequest();
        IdmRoleRequestDto request = null;
        if (requestId == null) {
            request = this.createRequest(identityContractDto.getIdentity());
            requestId = request.getId();
        }
        IdmConceptRoleRequestDto conceptRoleRequest = createConcept(identityRole, identityContractDto, requestId, identityRole.getRole(), identityContractDto.getValidFrom(), identityContractDto.getValidTill(), ConceptRoleRequestOperation.UPDATE);
        conceptRoleRequest.setValidFrom(dto.getValidFrom());
        conceptRoleRequest.setValidTill(dto.getValidTill());
        conceptRoleRequest.setRoleSystem(dto.getRoleSystem());
        conceptRoleRequest.setEavs(dto.getEavs());
        // Create concept with EAVs
        conceptRoleRequest = conceptRoleService.save(conceptRoleRequest, permission);
        if (request != null) {
            // Add request to concept. Will be used on the FE (prevent loading of request).
            conceptRoleRequest.getEmbedded().put(IdmConceptRoleRequest_.roleRequest.getName(), request);
        }
        return this.conceptToRequestIdentityRole(conceptRoleRequest, null);
    } else if (dto.getId() == null && dto.getIdentityRole() == null) {
        // Given DTO does not have ID neither identity-role ID -> create ADD concept
        Assert.notNull(dto.getIdentityContract(), "Contract is required.");
        Set<UUID> roles = Sets.newHashSet();
        if (dto.getRole() != null) {
            roles.add(dto.getRole());
        }
        if (dto.getRoles() != null) {
            roles.addAll(dto.getRoles());
        }
        Assert.notEmpty(roles, "Roles cannot be empty!");
        IdmIdentityContractDto identityContractDto = identityContractService.get(dto.getIdentityContract());
        UUID requestId = dto.getRoleRequest();
        IdmRoleRequestDto request = null;
        if (requestId == null) {
            request = this.createRequest(identityContractDto.getIdentity());
            requestId = request.getId();
        }
        List<IdmConceptRoleRequestDto> concepts = Lists.newArrayList();
        UUID finalRequestId = requestId;
        IdmRoleRequestDto finalRequest = request;
        roles.forEach(role -> {
            IdmConceptRoleRequestDto conceptRoleRequest = createConcept(null, identityContractDto, finalRequestId, role, dto.getValidFrom(), dto.getValidTill(), ConceptRoleRequestOperation.ADD);
            conceptRoleRequest.setEavs(dto.getEavs());
            conceptRoleRequest.setRoleSystem(dto.getRoleSystem());
            // Create concept with EAVs
            conceptRoleRequest = conceptRoleService.save(conceptRoleRequest);
            if (finalRequest != null) {
                // Add request to concept. Will be used on the FE (prevent loading of request).
                conceptRoleRequest.getEmbedded().put(IdmConceptRoleRequest_.roleRequest.getName(), finalRequest);
            }
            concepts.add(conceptRoleRequest);
        });
        // Beware more then one concepts could be created, but only first will be returned!
        return this.conceptToRequestIdentityRole(concepts.get(0), null);
    } else {
        // Try to find role-concept
        IdmConceptRoleRequestDto roleConceptDto = conceptRoleService.get(dto.getId());
        if (roleConceptDto != null) {
            dto.setState(roleConceptDto.getState());
            if (ConceptRoleRequestOperation.UPDATE == roleConceptDto.getOperation()) {
                // Given DTO is concept -> update exists UPDATE concept
                return this.conceptToRequestIdentityRole(conceptRoleService.save(dto, permission), null);
            }
            if (ConceptRoleRequestOperation.ADD == roleConceptDto.getOperation()) {
                // Given DTO is concept -> update exists ADD concept
                return this.conceptToRequestIdentityRole(conceptRoleService.save(dto, permission), null);
            }
        }
    }
    return null;
}
Also used : IdmConceptRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmConceptRoleRequestService) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmRequestIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRequestIdentityRoleDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) AbstractReadDtoService(eu.bcvsolutions.idm.core.api.service.AbstractReadDtoService) Autowired(org.springframework.beans.factory.annotation.Autowired) IdmRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService) RoleBasePermission(eu.bcvsolutions.idm.core.security.api.domain.RoleBasePermission) IdmRequestIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmRequestIdentityRoleService) IdmConceptRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmConceptRoleRequest_) AbstractBaseDtoService(eu.bcvsolutions.idm.core.rest.AbstractBaseDtoService) BasePermission(eu.bcvsolutions.idm.core.security.api.domain.BasePermission) Pageable(org.springframework.data.domain.Pageable) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) Set(java.util.Set) PageRequest(org.springframework.data.domain.PageRequest) UUID(java.util.UUID) Page(org.springframework.data.domain.Page) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) List(java.util.List) ContractBasePermission(eu.bcvsolutions.idm.core.security.api.domain.ContractBasePermission) PermissionUtils(eu.bcvsolutions.idm.core.security.api.utils.PermissionUtils) LocalDate(java.time.LocalDate) PageImpl(org.springframework.data.domain.PageImpl) IdmIdentityRole_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityRole_) RoleRequestedByType(eu.bcvsolutions.idm.core.api.domain.RoleRequestedByType) IdmRoleSystemService(eu.bcvsolutions.idm.core.api.service.IdmRoleSystemService) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ModelMapper(org.modelmapper.ModelMapper) Lists(com.google.common.collect.Lists) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) Service(org.springframework.stereotype.Service) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) WorkflowProcessInstanceService(eu.bcvsolutions.idm.core.workflow.service.WorkflowProcessInstanceService) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) IdmRoleSystemFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleSystemFilter) BaseFilter(eu.bcvsolutions.idm.core.api.dto.filter.BaseFilter) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmRequestIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestIdentityRoleFilter) ConceptRoleRequestOperation(eu.bcvsolutions.idm.core.api.domain.ConceptRoleRequestOperation) IdmConceptRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmConceptRoleRequestFilter) Transactional(org.springframework.transaction.annotation.Transactional) Assert(org.springframework.util.Assert) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) Set(java.util.Set) HashSet(java.util.HashSet) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) List(java.util.List) ArrayList(java.util.ArrayList) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) UUID(java.util.UUID) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with IdmConceptRoleRequest_

use of eu.bcvsolutions.idm.core.model.entity.IdmConceptRoleRequest_ in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleRequestService method convertConceptRoleToIdentityRole.

private IdmIdentityRoleDto convertConceptRoleToIdentityRole(List<IdmConceptRoleRequestDto> allConcepts, IdmConceptRoleRequestDto conceptRole, IdmIdentityRoleDto identityRole) {
    if (conceptRole == null || identityRole == null) {
        return null;
    }
    IdmRoleDto roleDto = DtoUtils.getEmbedded(conceptRole, IdmConceptRoleRequest_.role, IdmRoleDto.class);
    if (roleDto != null && roleDto.getIdentityRoleAttributeDefinition() != null) {
        IdmFormDefinitionDto formDefinitionDto = roleService.getFormAttributeSubdefinition(roleDto);
        formService.mergeValues(formDefinitionDto, conceptRole, identityRole);
    }
    identityRole.setRole(conceptRole.getRole());
    identityRole.setIdentityContract(conceptRole.getIdentityContract());
    identityRole.setContractPosition(conceptRole.getContractPosition());
    identityRole.setValidFrom(conceptRole.getValidFrom());
    identityRole.setValidTill(conceptRole.getValidTill());
    identityRole.setOriginalCreator(conceptRole.getOriginalCreator());
    identityRole.setOriginalCreatorId(conceptRole.getOriginalCreatorId());
    identityRole.setOriginalModifier(conceptRole.getOriginalModifier());
    identityRole.setOriginalModifierId(conceptRole.getOriginalModifierId());
    identityRole.setAutomaticRole(conceptRole.getAutomaticRole());
    // fill directly assigned role by superior concept
    UUID directRole = conceptRole.getDirectRole();
    UUID directConcept = conceptRole.getDirectConcept();
    if (directRole != null) {
        // update / delete / new role composition
        identityRole.setDirectRole(directRole);
    } else if (directConcept != null) {
        // new identity role by superior concept
        directRole = allConcepts.stream().filter(c -> c.getId().equals(directConcept)).findFirst().get().getIdentityRole();
        identityRole.setDirectRole(directRole);
    }
    identityRole.setRoleComposition(conceptRole.getRoleComposition());
    identityRole.setRoleSystem(conceptRole.getRoleSystem());
    return identityRole;
}
Also used : DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) ZonedDateTime(java.time.ZonedDateTime) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SiemLoggerManager(eu.bcvsolutions.idm.core.api.audit.service.SiemLoggerManager) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) StringUtils(org.apache.commons.lang3.StringUtils) SecurityService(eu.bcvsolutions.idm.core.security.api.service.SecurityService) Predicate(javax.persistence.criteria.Predicate) IdmConceptRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmConceptRoleRequest_) Map(java.util.Map) CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) CriteriaQuery(javax.persistence.criteria.CriteriaQuery) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Loggable(eu.bcvsolutions.idm.core.api.domain.Loggable) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) Set(java.util.Set) IdentityRoleEvent(eu.bcvsolutions.idm.core.model.event.IdentityRoleEvent) WorkflowHistoricProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowHistoricProcessInstanceDto) Serializable(java.io.Serializable) IdmRoleRequestRepository(eu.bcvsolutions.idm.core.model.repository.IdmRoleRequestRepository) IOUtils(org.apache.commons.io.IOUtils) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) IdmRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmRoleRequest_) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) IdmAccountDto(eu.bcvsolutions.idm.core.api.dto.IdmAccountDto) IdmRoleCompositionDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto) Session(org.hibernate.Session) BooleanUtils(org.apache.commons.lang3.BooleanUtils) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Strings(com.google.common.base.Strings) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Lists(com.google.common.collect.Lists) Service(org.springframework.stereotype.Service) WorkflowProcessInstanceService(eu.bcvsolutions.idm.core.workflow.service.WorkflowProcessInstanceService) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) Root(javax.persistence.criteria.Root) WorkflowHistoricProcessInstanceService(eu.bcvsolutions.idm.core.workflow.service.WorkflowHistoricProcessInstanceService) DuplicateRolesDto(eu.bcvsolutions.idm.core.api.dto.DuplicateRolesDto) CoreException(eu.bcvsolutions.idm.core.api.exception.CoreException) AbstractEventableDtoService(eu.bcvsolutions.idm.core.api.service.AbstractEventableDtoService) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IOException(java.io.IOException) RoleRequestState(eu.bcvsolutions.idm.core.api.domain.RoleRequestState) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) ConceptRoleRequestOperation(eu.bcvsolutions.idm.core.api.domain.ConceptRoleRequestOperation) IdmConceptRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmConceptRoleRequestFilter) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) IdmIdentityRoleThinService(eu.bcvsolutions.idm.core.api.service.thin.IdmIdentityRoleThinService) AuthorizableType(eu.bcvsolutions.idm.core.security.api.dto.AuthorizableType) IdmRoleRequestByIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestByIdentityDto) IdmConceptRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmConceptRoleRequestService) ByteArrayInputStream(org.fusesource.hawtbuf.ByteArrayInputStream) RoleRequestException(eu.bcvsolutions.idm.core.api.exception.RoleRequestException) WorkflowProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto) IdmRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmFormAttributeService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormAttributeService) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Objects(com.google.common.base.Objects) ImmutableMap(com.google.common.collect.ImmutableMap) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) IdmRoleCompositionService(eu.bcvsolutions.idm.core.api.service.IdmRoleCompositionService) IdmRoleRequest(eu.bcvsolutions.idm.core.model.entity.IdmRoleRequest) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) PriorityType(eu.bcvsolutions.idm.core.api.domain.PriorityType) List(java.util.List) ExceptionUtils(eu.bcvsolutions.idm.core.api.utils.ExceptionUtils) LocalDate(java.time.LocalDate) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) RoleRequestEventType(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent.RoleRequestEventType) RoleRequestApprovalProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleRequestApprovalProcessor) ValueGeneratorManager(eu.bcvsolutions.idm.core.api.service.ValueGeneratorManager) IdmIdentityRole_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityRole_) RoleRequestedByType(eu.bcvsolutions.idm.core.api.domain.RoleRequestedByType) HashMap(java.util.HashMap) MessageFormat(java.text.MessageFormat) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) HashSet(java.util.HashSet) Propagation(org.springframework.transaction.annotation.Propagation) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) IdentityRoleEventType(eu.bcvsolutions.idm.core.model.event.IdentityRoleEvent.IdentityRoleEventType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmRoleComposition_(eu.bcvsolutions.idm.core.model.entity.IdmRoleComposition_) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) PROPERTY_STATE(eu.bcvsolutions.idm.core.api.dto.OperationResultDto.PROPERTY_STATE) ApplicationContext(org.springframework.context.ApplicationContext) IdmIncompatibleRoleService(eu.bcvsolutions.idm.core.api.service.IdmIncompatibleRoleService) IdmFormValue_(eu.bcvsolutions.idm.core.eav.entity.IdmFormValue_) RoleRequestEvent(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent) ResolvedIncompatibleRoleDto(eu.bcvsolutions.idm.core.api.dto.ResolvedIncompatibleRoleDto) InputStream(java.io.InputStream) Transactional(org.springframework.transaction.annotation.Transactional) Assert(org.springframework.util.Assert) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) UUID(java.util.UUID)

Example 3 with IdmConceptRoleRequest_

use of eu.bcvsolutions.idm.core.model.entity.IdmConceptRoleRequest_ in project CzechIdMng by bcvsolutions.

the class DefaultIdmRoleRequestService method getIncompatibleRoles.

@Override
public Set<ResolvedIncompatibleRoleDto> getIncompatibleRoles(IdmRoleRequestDto request, IdmBasePermission... permissions) {
    // Currently assigned roles
    IdmIdentityRoleFilter identityRoleFilter = new IdmIdentityRoleFilter();
    identityRoleFilter.setIdentityId(request.getApplicant());
    List<IdmIdentityRoleDto> identityRoles = identityRoleService.find(identityRoleFilter, null, permissions).getContent();
    // Roles from concepts
    IdmConceptRoleRequestFilter conceptFilter = new IdmConceptRoleRequestFilter();
    conceptFilter.setRoleRequestId(request.getId());
    List<IdmConceptRoleRequestDto> concepts = conceptRoleRequestService.find(conceptFilter, null, permissions).getContent();
    Set<UUID> removedIdentityRoleIds = new HashSet<>();
    // We don't want calculate incompatible roles for ended or disapproved concepts
    List<IdmConceptRoleRequestDto> conceptsForCheck = // 
    concepts.stream().filter(concept -> {
        // role can be deleted in the mean time
        return concept.getRole() != null;
    }).filter(// 
    concept -> // 
    RoleRequestState.CONCEPT == concept.getState() || RoleRequestState.IN_PROGRESS == concept.getState() || RoleRequestState.APPROVED == concept.getState() || // 
    RoleRequestState.EXECUTED == concept.getState()).collect(Collectors.toList());
    Set<IdmRoleDto> roles = new HashSet<>();
    conceptsForCheck.stream().filter(concept -> {
        boolean isDelete = concept.getOperation() == ConceptRoleRequestOperation.REMOVE;
        if (isDelete) {
            // removed role fixes the incompatibility
            removedIdentityRoleIds.add(concept.getIdentityRole());
        }
        return !isDelete;
    }).forEach(concept -> roles.add(DtoUtils.getEmbedded(concept, IdmConceptRoleRequest_.role)));
    identityRoles.stream().filter(identityRole -> !removedIdentityRoleIds.contains(identityRole.getId())).forEach(identityRole -> roles.add(DtoUtils.getEmbedded(identityRole, IdmIdentityRole_.role)));
    // We want to returns only incompatibilities caused by new added roles
    Set<ResolvedIncompatibleRoleDto> incompatibleRoles = incompatibleRoleService.resolveIncompatibleRoles(Lists.newArrayList(roles));
    return // 
    incompatibleRoles.stream().filter(incompatibleRole -> {
        return // 
        conceptsForCheck.stream().anyMatch(concept -> concept.getOperation() == ConceptRoleRequestOperation.ADD && (concept.getRole().equals(incompatibleRole.getDirectRole().getId()) || concept.getRole().equals(incompatibleRole.getIncompatibleRole().getSuperior()) || concept.getRole().equals(incompatibleRole.getIncompatibleRole().getSub())));
    // 
    }).collect(Collectors.toSet());
}
Also used : DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) ZonedDateTime(java.time.ZonedDateTime) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SiemLoggerManager(eu.bcvsolutions.idm.core.api.audit.service.SiemLoggerManager) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) StringUtils(org.apache.commons.lang3.StringUtils) SecurityService(eu.bcvsolutions.idm.core.security.api.service.SecurityService) Predicate(javax.persistence.criteria.Predicate) IdmConceptRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmConceptRoleRequest_) Map(java.util.Map) CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) CriteriaQuery(javax.persistence.criteria.CriteriaQuery) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) Loggable(eu.bcvsolutions.idm.core.api.domain.Loggable) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) Set(java.util.Set) IdentityRoleEvent(eu.bcvsolutions.idm.core.model.event.IdentityRoleEvent) WorkflowHistoricProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowHistoricProcessInstanceDto) Serializable(java.io.Serializable) IdmRoleRequestRepository(eu.bcvsolutions.idm.core.model.repository.IdmRoleRequestRepository) IOUtils(org.apache.commons.io.IOUtils) IdmRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleRequestFilter) IdmRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmRoleRequest_) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) IdmAccountDto(eu.bcvsolutions.idm.core.api.dto.IdmAccountDto) IdmRoleCompositionDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto) Session(org.hibernate.Session) BooleanUtils(org.apache.commons.lang3.BooleanUtils) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Strings(com.google.common.base.Strings) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Lists(com.google.common.collect.Lists) Service(org.springframework.stereotype.Service) WorkflowProcessInstanceService(eu.bcvsolutions.idm.core.workflow.service.WorkflowProcessInstanceService) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) WorkflowFilterDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowFilterDto) Root(javax.persistence.criteria.Root) WorkflowHistoricProcessInstanceService(eu.bcvsolutions.idm.core.workflow.service.WorkflowHistoricProcessInstanceService) DuplicateRolesDto(eu.bcvsolutions.idm.core.api.dto.DuplicateRolesDto) CoreException(eu.bcvsolutions.idm.core.api.exception.CoreException) AbstractEventableDtoService(eu.bcvsolutions.idm.core.api.service.AbstractEventableDtoService) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) IOException(java.io.IOException) RoleRequestState(eu.bcvsolutions.idm.core.api.domain.RoleRequestState) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) CoreResultCode(eu.bcvsolutions.idm.core.api.domain.CoreResultCode) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) ConceptRoleRequestOperation(eu.bcvsolutions.idm.core.api.domain.ConceptRoleRequestOperation) IdmConceptRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmConceptRoleRequestFilter) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) IdmIdentityRoleThinService(eu.bcvsolutions.idm.core.api.service.thin.IdmIdentityRoleThinService) AuthorizableType(eu.bcvsolutions.idm.core.security.api.dto.AuthorizableType) IdmRoleRequestByIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestByIdentityDto) IdmConceptRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmConceptRoleRequestService) ByteArrayInputStream(org.fusesource.hawtbuf.ByteArrayInputStream) RoleRequestException(eu.bcvsolutions.idm.core.api.exception.RoleRequestException) WorkflowProcessInstanceDto(eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessInstanceDto) IdmRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService) CoreGroupPermission(eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmFormAttributeService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormAttributeService) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Objects(com.google.common.base.Objects) ImmutableMap(com.google.common.collect.ImmutableMap) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) IdmRoleCompositionService(eu.bcvsolutions.idm.core.api.service.IdmRoleCompositionService) IdmRoleRequest(eu.bcvsolutions.idm.core.model.entity.IdmRoleRequest) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) PriorityType(eu.bcvsolutions.idm.core.api.domain.PriorityType) List(java.util.List) ExceptionUtils(eu.bcvsolutions.idm.core.api.utils.ExceptionUtils) LocalDate(java.time.LocalDate) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) RoleRequestEventType(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent.RoleRequestEventType) RoleRequestApprovalProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleRequestApprovalProcessor) ValueGeneratorManager(eu.bcvsolutions.idm.core.api.service.ValueGeneratorManager) IdmIdentityRole_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityRole_) RoleRequestedByType(eu.bcvsolutions.idm.core.api.domain.RoleRequestedByType) HashMap(java.util.HashMap) MessageFormat(java.text.MessageFormat) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) HashSet(java.util.HashSet) Propagation(org.springframework.transaction.annotation.Propagation) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) IdentityRoleEventType(eu.bcvsolutions.idm.core.model.event.IdentityRoleEvent.IdentityRoleEventType) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) IdmRoleComposition_(eu.bcvsolutions.idm.core.model.entity.IdmRoleComposition_) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) PROPERTY_STATE(eu.bcvsolutions.idm.core.api.dto.OperationResultDto.PROPERTY_STATE) ApplicationContext(org.springframework.context.ApplicationContext) IdmIncompatibleRoleService(eu.bcvsolutions.idm.core.api.service.IdmIncompatibleRoleService) IdmFormValue_(eu.bcvsolutions.idm.core.eav.entity.IdmFormValue_) RoleRequestEvent(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent) ResolvedIncompatibleRoleDto(eu.bcvsolutions.idm.core.api.dto.ResolvedIncompatibleRoleDto) InputStream(java.io.InputStream) Transactional(org.springframework.transaction.annotation.Transactional) Assert(org.springframework.util.Assert) InvalidFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) IdmConceptRoleRequestFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmConceptRoleRequestFilter) ResolvedIncompatibleRoleDto(eu.bcvsolutions.idm.core.api.dto.ResolvedIncompatibleRoleDto) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) UUID(java.util.UUID) HashSet(java.util.HashSet)

Aggregations

Lists (com.google.common.collect.Lists)3 Sets (com.google.common.collect.Sets)3 ConceptRoleRequestOperation (eu.bcvsolutions.idm.core.api.domain.ConceptRoleRequestOperation)3 RoleRequestedByType (eu.bcvsolutions.idm.core.api.domain.RoleRequestedByType)3 IdmConceptRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto)3 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)3 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)3 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)3 IdmRoleRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto)3 IdmConceptRoleRequestFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmConceptRoleRequestFilter)3 IdmIdentityRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter)3 IdmConceptRoleRequestService (eu.bcvsolutions.idm.core.api.service.IdmConceptRoleRequestService)3 IdmIdentityContractService (eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService)3 IdmIdentityRoleService (eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService)3 IdmRoleRequestService (eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService)3 IdmRoleService (eu.bcvsolutions.idm.core.api.service.IdmRoleService)3 DtoUtils (eu.bcvsolutions.idm.core.api.utils.DtoUtils)3 IdmFormInstanceDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto)3 InvalidFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.InvalidFormAttributeDto)3 IdmConceptRoleRequest_ (eu.bcvsolutions.idm.core.model.entity.IdmConceptRoleRequest_)3