Search in sources :

Example 1 with IdmFormValue_

use of eu.bcvsolutions.idm.core.eav.entity.IdmFormValue_ in project CzechIdMng by bcvsolutions.

the class IdentityProvisioningExecutor method convertToAssignedRoleDto.

public static AssignedRoleDto convertToAssignedRoleDto(IdmIdentityRoleDto identityRole) {
    if (identityRole == null) {
        return null;
    }
    AssignedRoleDto dto = new AssignedRoleDto();
    dto.setId(identityRole.getId());
    dto.setExternalId(identityRole.getExternalId());
    dto.setValidFrom(identityRole.getValidFrom());
    dto.setValidTill(identityRole.getValidTill());
    dto.setRole(DtoUtils.getEmbedded(identityRole, IdmIdentityRole_.role, IdmRoleDto.class, null));
    dto.setIdentityContract(DtoUtils.getEmbedded(identityRole, IdmIdentityRole_.identityContract, IdmIdentityContractDto.class, null));
    dto.setContractPosition(DtoUtils.getEmbedded(identityRole, IdmIdentityRole_.contractPosition, IdmContractPositionDto.class, null));
    dto.setDirectRole(DtoUtils.getEmbedded(identityRole, IdmIdentityRole_.directRole, IdmIdentityRoleDto.class, null));
    dto.setRoleTreeNode(DtoUtils.getEmbedded(identityRole, IdmIdentityRoleDto.PROPERTY_ROLE_TREE_NODE, AbstractIdmAutomaticRoleDto.class, null));
    dto.setRoleComposition(DtoUtils.getEmbedded(identityRole, IdmIdentityRole_.roleComposition, IdmRoleCompositionDto.class, null));
    UUID definition = dto.getRole().getIdentityRoleAttributeDefinition();
    if (definition != null) {
        // Definition for role attributes exists
        IdmFormInstanceDto formInstanceDto = // 
        identityRole.getEavs().stream().filter(// 
        formInstance -> definition.equals(formInstance.getFormDefinition().getId())).findFirst().orElse(null);
        if (formInstanceDto != null) {
            List<IdmFormValueDto> values = formInstanceDto.getValues();
            // Search all attributes
            values.stream().map(// 
            IdmFormValueDto::getFormAttribute).distinct().forEach(attribute -> {
                List<IdmFormValueDto> formValues = // Search all values for one attribute
                values.stream().filter(// 
                value -> attribute.equals(value.getFormAttribute())).collect(// 
                Collectors.toList());
                IdmFormAttributeDto formAttributeDto = DtoUtils.getEmbedded(formValues.get(0), IdmFormValue_.formAttribute, IdmFormAttributeDto.class);
                dto.getAttributes().put(formAttributeDto.getCode(), // 
                formValues.stream().map(// Value is always list
                IdmFormValueDto::getValue).collect(// 
                Collectors.toList()));
            });
        }
    }
    return dto;
}
Also used : IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) ProvisioningExecutor(eu.bcvsolutions.idm.acc.service.api.ProvisioningExecutor) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) AccIdentityAccount_(eu.bcvsolutions.idm.acc.entity.AccIdentityAccount_) EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) Sort(org.springframework.data.domain.Sort) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) ReadWriteDtoService(eu.bcvsolutions.idm.core.api.service.ReadWriteDtoService) PageRequest(org.springframework.data.domain.PageRequest) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) IdmContractPositionDto(eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) List(java.util.List) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) SysRoleSystemAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemAttributeFilter) CollectionUtils(org.springframework.util.CollectionUtils) AccIdentityAccountService(eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmIdentityService(eu.bcvsolutions.idm.core.api.service.IdmIdentityService) MappingContext(eu.bcvsolutions.idm.acc.domain.MappingContext) AbstractIdmAutomaticRoleDto(eu.bcvsolutions.idm.core.api.dto.AbstractIdmAutomaticRoleDto) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) IdmIdentityRole_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityRole_) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) IdmRoleCompositionDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysRoleSystemAttribute_(eu.bcvsolutions.idm.acc.entity.SysRoleSystemAttribute_) ArrayList(java.util.ArrayList) AccAccountManagementService(eu.bcvsolutions.idm.acc.service.api.AccAccountManagementService) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) Lists(com.google.common.collect.Lists) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) Service(org.springframework.stereotype.Service) Qualifier(org.springframework.beans.factory.annotation.Qualifier) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) AssignedRoleDto(eu.bcvsolutions.idm.acc.domain.AssignedRoleDto) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmFormValue_(eu.bcvsolutions.idm.core.eav.entity.IdmFormValue_) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) EntityEventManager(eu.bcvsolutions.idm.core.api.service.EntityEventManager) Assert(org.springframework.util.Assert) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmContractPositionDto(eu.bcvsolutions.idm.core.api.dto.IdmContractPositionDto) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmRoleCompositionDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCompositionDto) AssignedRoleDto(eu.bcvsolutions.idm.acc.domain.AssignedRoleDto) AbstractIdmAutomaticRoleDto(eu.bcvsolutions.idm.core.api.dto.AbstractIdmAutomaticRoleDto) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) UUID(java.util.UUID) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)

Aggregations

Lists (com.google.common.collect.Lists)1 AssignedRoleDto (eu.bcvsolutions.idm.acc.domain.AssignedRoleDto)1 AttributeMapping (eu.bcvsolutions.idm.acc.domain.AttributeMapping)1 AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)1 MappingContext (eu.bcvsolutions.idm.acc.domain.MappingContext)1 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)1 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)1 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)1 EntityAccountDto (eu.bcvsolutions.idm.acc.dto.EntityAccountDto)1 SysRoleSystemAttributeDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)1 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)1 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)1 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)1 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)1 SysRoleSystemAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemAttributeFilter)1 AccIdentityAccount_ (eu.bcvsolutions.idm.acc.entity.AccIdentityAccount_)1 SysRoleSystemAttribute_ (eu.bcvsolutions.idm.acc.entity.SysRoleSystemAttribute_)1 AccAccountManagementService (eu.bcvsolutions.idm.acc.service.api.AccAccountManagementService)1 AccAccountService (eu.bcvsolutions.idm.acc.service.api.AccAccountService)1 AccIdentityAccountService (eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService)1