Search in sources :

Example 21 with SysSchemaAttributeFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter in project CzechIdMng by bcvsolutions.

the class AccountManagementTest method createMapping.

private void createMapping(SysSystemDto system, final SysSystemMappingDto entityHandlingResult) {
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(system.getId());
    Page<SysSchemaAttributeDto> schemaAttributesPage = schemaAttributeService.find(schemaAttributeFilter, null);
    schemaAttributesPage.forEach(schemaAttr -> {
        if (ATTRIBUTE_NAME.equals(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setUid(true);
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setIdmPropertyName("name");
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            // For provisioning .. we need create UID
            attributeHandlingName.setTransformToResourceScript("return entity.getName();");
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("TYPE".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("roleType");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("PRIORITY".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("priority");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("APPROVE_REMOVE".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("approveRemove");
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("MODIFIED".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("changed");
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setEntityAttribute(false);
            attributeHandlingName.setExtendedAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("DESCRIPTION".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("description");
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setEntityAttribute(true);
            ;
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        }
    });
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)

Example 22 with SysSchemaAttributeFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter in project CzechIdMng by bcvsolutions.

the class AccountManagementTest method createIdentityMapping.

private void createIdentityMapping(SysSystemDto system, final SysSystemMappingDto entityHandlingResult) {
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(system.getId());
    Page<SysSchemaAttributeDto> schemaAttributesPage = schemaAttributeService.find(schemaAttributeFilter, null);
    schemaAttributesPage.forEach(schemaAttr -> {
        if (ATTRIBUTE_NAME.equals(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setUid(true);
            attributeMapping.setEntityAttribute(true);
            attributeMapping.setIdmPropertyName("username");
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if ("firstname".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setIdmPropertyName("firstName");
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if ("lastname".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setIdmPropertyName("lastName");
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if (ATTRIBUTE_EMAIL.equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setIdmPropertyName("email");
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        }
    });
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)

Example 23 with SysSchemaAttributeFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter in project CzechIdMng by bcvsolutions.

the class IdentityRoleValidRequestSchedulerTest method createAndSaveSystemWithMapping.

private SysSystemDto createAndSaveSystemWithMapping() {
    system = null;
    systemMapping = null;
    SysSystemAttributeMappingDto nameAttributeMapping = null;
    SysSystemAttributeMappingDto firstNameAttributeMapping = null;
    SysSystemAttributeMappingDto lastNameAttributeMapping = null;
    SysSystemAttributeMappingDto passwordAttributeMapping = null;
    // prepare test system
    system = helper.createSystem(TestResource.TABLE_NAME);
    // generate schema
    List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
    // create test mapping
    systemMapping = new SysSystemMappingDto();
    systemMapping.setName("default_" + System.currentTimeMillis());
    systemMapping.setEntityType(SystemEntityType.IDENTITY);
    systemMapping.setOperationType(SystemOperationType.PROVISIONING);
    systemMapping.setObjectClass(objectClasses.get(0).getId());
    systemMapping = mappingService.save(systemMapping);
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(system.getId());
    Page<SysSchemaAttributeDto> schemaAttributesPage = schemaAttributeService.find(schemaAttributeFilter, null);
    for (SysSchemaAttributeDto schemaAttr : schemaAttributesPage) {
        if ("__NAME__".equals(schemaAttr.getName())) {
            nameAttributeMapping = new SysSystemAttributeMappingDto();
            nameAttributeMapping.setUid(true);
            nameAttributeMapping.setEntityAttribute(true);
            nameAttributeMapping.setIdmPropertyName("username");
            nameAttributeMapping.setName(schemaAttr.getName());
            nameAttributeMapping.setSchemaAttribute(schemaAttr.getId());
            nameAttributeMapping.setSystemMapping(systemMapping.getId());
            nameAttributeMapping = attributeMappingService.save(nameAttributeMapping);
        } else if ("firstname".equalsIgnoreCase(schemaAttr.getName())) {
            firstNameAttributeMapping = new SysSystemAttributeMappingDto();
            firstNameAttributeMapping.setIdmPropertyName("firstName");
            firstNameAttributeMapping.setSchemaAttribute(schemaAttr.getId());
            firstNameAttributeMapping.setName(schemaAttr.getName());
            firstNameAttributeMapping.setSystemMapping(systemMapping.getId());
            firstNameAttributeMapping = attributeMappingService.save(firstNameAttributeMapping);
        } else if ("lastname".equalsIgnoreCase(schemaAttr.getName())) {
            lastNameAttributeMapping = new SysSystemAttributeMappingDto();
            lastNameAttributeMapping.setIdmPropertyName("lastName");
            lastNameAttributeMapping.setName(schemaAttr.getName());
            lastNameAttributeMapping.setSchemaAttribute(schemaAttr.getId());
            lastNameAttributeMapping.setSystemMapping(systemMapping.getId());
            lastNameAttributeMapping = attributeMappingService.save(lastNameAttributeMapping);
        } else if (IcConnectorFacade.PASSWORD_ATTRIBUTE_NAME.equalsIgnoreCase(schemaAttr.getName())) {
            passwordAttributeMapping = new SysSystemAttributeMappingDto();
            passwordAttributeMapping.setIdmPropertyName("password");
            passwordAttributeMapping.setSchemaAttribute(schemaAttr.getId());
            passwordAttributeMapping.setName(schemaAttr.getName());
            passwordAttributeMapping.setSystemMapping(systemMapping.getId());
            passwordAttributeMapping = attributeMappingService.save(passwordAttributeMapping);
        }
    }
    assertNotNull(system);
    assertNotNull(nameAttributeMapping);
    assertNotNull(firstNameAttributeMapping);
    assertNotNull(lastNameAttributeMapping);
    assertNotNull(passwordAttributeMapping);
    return system;
}
Also used : SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)

Example 24 with SysSchemaAttributeFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter in project CzechIdMng by bcvsolutions.

the class DefaultRoleSynchronizationServiceTest method createMapping.

private void createMapping(SysSystemDto system, final SysSystemMappingDto entityHandlingResult) {
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(system.getId());
    Page<SysSchemaAttributeDto> schemaAttributesPage = schemaAttributeService.find(schemaAttributeFilter, null);
    schemaAttributesPage.forEach(schemaAttr -> {
        if (ATTRIBUTE_NAME.equals(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setUid(true);
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setIdmPropertyName("name");
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            // For provisioning .. we need create UID
            attributeHandlingName.setTransformToResourceScript("return entity.getName();");
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("TYPE".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("roleType");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("PRIORITY".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("priority");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("APPROVE_REMOVE".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("approveRemove");
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("MODIFIED".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("changed");
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setEntityAttribute(false);
            attributeHandlingName.setExtendedAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("DESCRIPTION".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("description");
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setEntityAttribute(true);
            ;
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        }
    });
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)

Example 25 with SysSchemaAttributeFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter in project CzechIdMng by bcvsolutions.

the class DefaultSynchronizationServiceTest method createMapping.

private void createMapping(SysSystemDto system, final SysSystemMappingDto entityHandlingResult) {
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(system.getId());
    Page<SysSchemaAttributeDto> schemaAttributesPage = schemaAttributeService.find(schemaAttributeFilter, null);
    schemaAttributesPage.forEach(schemaAttr -> {
        if (ATTRIBUTE_NAME.equals(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setUid(true);
            attributeMapping.setEntityAttribute(true);
            attributeMapping.setIdmPropertyName("username");
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if ("firstname".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setIdmPropertyName("firstName");
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if ("lastname".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setIdmPropertyName("lastName");
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if (ATTRIBUTE_EMAIL.equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setIdmPropertyName("email");
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if (IcConnectorFacade.PASSWORD_ATTRIBUTE_NAME.equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setIdmPropertyName("password");
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setName(schemaAttr.getName());
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if (SystemOperationType.SYNCHRONIZATION == entityHandlingResult.getOperationType() && ATTRIBUTE_MODIFIED.equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setEntityAttribute(false);
            attributeMapping.setExtendedAttribute(true);
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setIdmPropertyName(ATTRIBUTE_MODIFIED);
            attributeMapping.setName(ATTRIBUTE_MODIFIED);
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        } else if (schemaAttr.getName().equals(EAV_ATTRIBUTE)) {
            SysSystemAttributeMappingDto attributeMapping = new SysSystemAttributeMappingDto();
            attributeMapping.setExtendedAttribute(true);
            attributeMapping.setEntityAttribute(false);
            attributeMapping.setSchemaAttribute(schemaAttr.getId());
            attributeMapping.setIdmPropertyName(EAV_ATTRIBUTE);
            attributeMapping.setName(EAV_ATTRIBUTE);
            attributeMapping.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeMapping);
        }
    });
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)

Aggregations

SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)27 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)21 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)19 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)11 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)11 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)9 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)7 Test (org.junit.Test)7 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)6 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)6 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)4 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)4 SysRoleSystemAttributeDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)3 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)3 SysSchemaObjectClassFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaObjectClassFilter)3 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)3 SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)3 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)3 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)2 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)2