Search in sources :

Example 36 with SysSystemAttributeMappingDto

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

the class DefaultSysSystemServiceTest method duplicateSystemWithSynchronization.

@Test
public void duplicateSystemWithSynchronization() {
    String syncName = "test-sync-config";
    // create test system
    SysSystemDto system = helper.createTestResourceSystem(true);
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(system.getId());
    // Number of schema attributes on original system
    int numberOfSchemaAttributesOrig = schemaAttributeService.find(schemaAttributeFilter, null).getContent().size();
    SysSystemMappingDto mappingOrig = helper.getDefaultMapping(system);
    // Number of mapping attributes on original system
    int numberOfMappingAttributesOrig = systemAttributeMappingService.findBySystemMapping(mappingOrig).size();
    SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
    attributeMappingFilter.setSystemMappingId(mappingOrig.getId());
    List<SysSystemAttributeMappingDto> attributes = schemaAttributeMappingService.find(attributeMappingFilter, null).getContent();
    SysSystemAttributeMappingDto nameAttribute = attributes.stream().filter(attribute -> {
        return attribute.getName().equals(TestHelper.ATTRIBUTE_MAPPING_NAME);
    }).findFirst().get();
    SysSystemAttributeMappingDto firstNameAttribute = attributes.stream().filter(attribute -> {
        return attribute.getName().equals(TestHelper.ATTRIBUTE_MAPPING_FIRSTNAME);
    }).findFirst().get();
    SysSystemAttributeMappingDto emailAttribute = attributes.stream().filter(attribute -> {
        return attribute.getName().equals(TestHelper.ATTRIBUTE_MAPPING_EMAIL);
    }).findFirst().get();
    // create synchronization config
    AbstractSysSyncConfigDto syncConfigDuplicate = new SysSyncIdentityConfigDto();
    syncConfigDuplicate.setCustomFilter(true);
    syncConfigDuplicate.setSystemMapping(mappingOrig.getId());
    syncConfigDuplicate.setCorrelationAttribute(nameAttribute.getId());
    syncConfigDuplicate.setTokenAttribute(firstNameAttribute.getId());
    syncConfigDuplicate.setFilterAttribute(emailAttribute.getId());
    syncConfigDuplicate.setReconciliation(true);
    syncConfigDuplicate.setName(syncName);
    syncConfigDuplicate.setLinkedAction(SynchronizationLinkedActionType.IGNORE);
    syncConfigDuplicate.setUnlinkedAction(SynchronizationUnlinkedActionType.IGNORE);
    syncConfigDuplicate.setMissingEntityAction(SynchronizationMissingEntityActionType.CREATE_ENTITY);
    syncConfigDuplicate.setMissingAccountAction(ReconciliationMissingAccountActionType.IGNORE);
    syncConfigDuplicate = syncConfigService.save(syncConfigDuplicate);
    SysSystemDto duplicatedSystem = systemService.duplicate(system.getId());
    // check duplicate
    systemService.checkSystem(duplicatedSystem);
    Assert.assertNotEquals(system.getId(), duplicatedSystem.getId());
    schemaAttributeFilter.setSystemId(duplicatedSystem.getId());
    // Number of schema attributes on duplicated system
    int numberOfSchemaAttributes = schemaAttributeService.find(schemaAttributeFilter, null).getContent().size();
    Assert.assertEquals(numberOfSchemaAttributesOrig, numberOfSchemaAttributes);
    SysSystemMappingDto mapping = helper.getDefaultMapping(duplicatedSystem);
    // Number of mapping attributes on duplicated system
    int numberOfMappingAttributes = systemAttributeMappingService.findBySystemMapping(mapping).size();
    Assert.assertEquals(numberOfMappingAttributesOrig, numberOfMappingAttributes);
    // check synchronization config
    SysSyncConfigFilter syncFilter = new SysSyncConfigFilter();
    syncFilter.setSystemId(duplicatedSystem.getId());
    List<AbstractSysSyncConfigDto> configs = syncConfigService.find(syncFilter, null).getContent();
    Assert.assertEquals(1, configs.size());
    Assert.assertEquals(1, configs.size());
    AbstractSysSyncConfigDto configNew = configs.get(0);
    Assert.assertFalse(configNew.isEnabled());
    Assert.assertTrue(configNew.isReconciliation());
    Assert.assertEquals(syncName, configNew.getName());
    Assert.assertTrue(configNew.isCustomFilter());
    Assert.assertEquals(syncConfigDuplicate.getLinkedAction(), configNew.getLinkedAction());
    Assert.assertEquals(syncConfigDuplicate.getUnlinkedAction(), configNew.getUnlinkedAction());
    Assert.assertEquals(syncConfigDuplicate.getMissingEntityAction(), configNew.getMissingEntityAction());
    Assert.assertEquals(syncConfigDuplicate.getMissingAccountAction(), configNew.getMissingAccountAction());
    SysSystemAttributeMappingDto correlationAtt = schemaAttributeMappingService.get(configNew.getCorrelationAttribute());
    SysSystemAttributeMappingDto tokenAtt = schemaAttributeMappingService.get(configNew.getTokenAttribute());
    SysSystemAttributeMappingDto filterAtt = schemaAttributeMappingService.get(configNew.getFilterAttribute());
    Assert.assertEquals(nameAttribute.getName(), correlationAtt.getName());
    Assert.assertEquals(nameAttribute.getIdmPropertyName(), correlationAtt.getIdmPropertyName());
    Assert.assertEquals(firstNameAttribute.getName(), tokenAtt.getName());
    Assert.assertEquals(firstNameAttribute.getIdmPropertyName(), tokenAtt.getIdmPropertyName());
    Assert.assertEquals(emailAttribute.getName(), filterAtt.getName());
    Assert.assertEquals(emailAttribute.getIdmPropertyName(), filterAtt.getIdmPropertyName());
}
Also used : SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 37 with SysSystemAttributeMappingDto

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

the class DefaultSysSystemServiceTest method testReferentialIntegrity.

@Test
public void testReferentialIntegrity() {
    SysSystemDto system = new SysSystemDto();
    String systemName = "t_s_" + System.currentTimeMillis();
    system.setName(systemName);
    system = systemService.save(system);
    // object class
    SysSchemaObjectClassDto objectClass = new SysSchemaObjectClassDto();
    objectClass.setSystem(system.getId());
    objectClass.setObjectClassName("obj_class");
    objectClass = schemaObjectClassService.save(objectClass);
    SysSchemaObjectClassFilter objectClassFilter = new SysSchemaObjectClassFilter();
    objectClassFilter.setSystemId(system.getId());
    // schema attribute
    SysSchemaAttributeDto schemaAttribute = new SysSchemaAttributeDto();
    schemaAttribute.setObjectClass(objectClass.getId());
    schemaAttribute.setName("name");
    schemaAttribute.setClassType("class");
    schemaAttribute = schemaAttributeService.save(schemaAttribute);
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(system.getId());
    // system entity handling
    SysSystemMappingDto systemMapping = new SysSystemMappingDto();
    systemMapping.setName("default_" + System.currentTimeMillis());
    systemMapping.setObjectClass(objectClass.getId());
    systemMapping.setOperationType(SystemOperationType.PROVISIONING);
    systemMapping.setEntityType(SystemEntityType.IDENTITY);
    systemMapping = systemMappingService.save(systemMapping);
    SysSystemMappingFilter entityHandlingFilter = new SysSystemMappingFilter();
    entityHandlingFilter.setSystemId(system.getId());
    // schema attribute handling
    SysSystemAttributeMappingDto schemaAttributeHandling = new SysSystemAttributeMappingDto();
    schemaAttributeHandling.setSchemaAttribute(schemaAttribute.getId());
    schemaAttributeHandling.setSystemMapping(systemMapping.getId());
    schemaAttributeHandling.setName("name");
    schemaAttributeHandling.setIdmPropertyName("name");
    schemaAttributeHandling = systemAttributeMappingService.save(schemaAttributeHandling);
    SysSystemAttributeMappingFilter schemaAttributeHandlingFilter = new SysSystemAttributeMappingFilter();
    schemaAttributeHandlingFilter.setSystemId(system.getId());
    // role system
    IdmRoleDto role = helper.createRole();
    SysRoleSystemDto roleSystem = new SysRoleSystemDto();
    roleSystem.setSystem(system.getId());
    roleSystem.setRole(role.getId());
    roleSystem.setSystemMapping(systemMapping.getId());
    roleSystem = roleSystemService.save(roleSystem);
    SysRoleSystemFilter roleSystemFilter = new SysRoleSystemFilter();
    roleSystemFilter.setRoleId(role.getId());
    // role system attributes
    SysRoleSystemAttributeDto roleSystemAttribute = new SysRoleSystemAttributeDto();
    roleSystemAttribute.setRoleSystem(roleSystem.getId());
    roleSystemAttribute.setSystemAttributeMapping(schemaAttributeHandling.getId());
    roleSystemAttribute.setName("name");
    roleSystemAttribute.setIdmPropertyName("name");
    roleSystemAttribute = roleSystemAttributeService.save(roleSystemAttribute);
    assertEquals(systemName, systemService.getByCode(systemName).getName());
    assertEquals(1, schemaObjectClassService.find(objectClassFilter, null).getTotalElements());
    assertEquals(1, schemaAttributeService.find(schemaAttributeFilter, null).getTotalElements());
    assertEquals(1, systemMappingService.find(entityHandlingFilter, null).getTotalElements());
    assertEquals(1, systemAttributeMappingService.find(schemaAttributeHandlingFilter, null).getTotalElements());
    assertEquals(1, roleSystemService.find(roleSystemFilter, null).getTotalElements());
    assertNotNull(roleSystemAttributeService.get(roleSystemAttribute.getId()));
    systemService.delete(system);
    assertNull(systemService.getByCode(systemName));
    assertEquals(0, schemaObjectClassService.find(objectClassFilter, null).getTotalElements());
    assertEquals(0, schemaAttributeService.find(schemaAttributeFilter, null).getTotalElements());
    assertEquals(0, systemMappingService.find(entityHandlingFilter, null).getTotalElements());
    assertEquals(0, systemAttributeMappingService.find(schemaAttributeHandlingFilter, null).getTotalElements());
    assertEquals(0, roleSystemService.find(roleSystemFilter, null).getTotalElements());
    assertNull(roleSystemAttributeService.get(roleSystemAttribute.getId()));
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSchemaObjectClassFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaObjectClassFilter) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysRoleSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 38 with SysSystemAttributeMappingDto

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

the class DefaultTreeSynchronizationServiceTest 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(false);
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            // For provisioning .. we need create UID
            attributeHandlingName.setTransformToResourceScript("if(uid){return uid;}\nreturn entity.getCode();");
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("CODE".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("code");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("PARENT".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("parent");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("NAME".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("name");
            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 39 with SysSystemAttributeMappingDto

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

the class GenerateSchemaWithEavTest 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 ("name".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setUid(true);
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if (!schemaAttr.getName().equals("__NAME__")) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName(schemaAttr.getName());
            attributeHandlingName.setEntityAttribute(false);
            attributeHandlingName.setExtendedAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            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 40 with SysSystemAttributeMappingDto

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

the class IdentityContractSyncTest 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 ("id".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setUid(true);
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            // it is for link and update situation
            attributeHandlingName.setIdmPropertyName(IdmIdentityContract_.description.getName());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("name".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName("position");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("owner".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName(ContractSynchronizationExecutor.CONTRACT_IDENTITY_FIELD);
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("workposition".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName(ContractSynchronizationExecutor.CONTRACT_WORK_POSITION_FIELD);
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("state".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName(ContractSynchronizationExecutor.CONTRACT_STATE_FIELD);
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setTransformFromResourceScript("return scriptEvaluator.evaluate(\n" + "    scriptEvaluator.newBuilder()\n" + "        .setScriptCode('compileIdentityRelationState')\n" + "        .addParameter('scriptEvaluator', scriptEvaluator)\n" + "        .addParameter('attributeValue', attributeValue)\n" + "        .addParameter('icAttributes', icAttributes)\n" + "        .addParameter('system', system)\n" + "	.build());");
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("leader".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setIdmPropertyName(ContractSynchronizationExecutor.CONTRACT_GUARANTEES_FIELD);
            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.setName(schemaAttr.getName());
            attributeHandlingName.setEntityAttribute(false);
            attributeHandlingName.setExtendedAttribute(false);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("validfrom".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setIdmPropertyName("validFrom");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setExtendedAttribute(false);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            attributeHandlingName.setTransformFromResourceScript("return attributeValue == null ? null : org.joda.time.LocalDate.parse(attributeValue);");
            schemaAttributeMappingService.save(attributeHandlingName);
        } else if ("validtill".equalsIgnoreCase(schemaAttr.getName())) {
            SysSystemAttributeMappingDto attributeHandlingName = new SysSystemAttributeMappingDto();
            attributeHandlingName.setName(schemaAttr.getName());
            attributeHandlingName.setIdmPropertyName("validTill");
            attributeHandlingName.setEntityAttribute(true);
            attributeHandlingName.setExtendedAttribute(false);
            attributeHandlingName.setSchemaAttribute(schemaAttr.getId());
            attributeHandlingName.setSystemMapping(entityHandlingResult.getId());
            attributeHandlingName.setTransformFromResourceScript("return attributeValue == null ? null : org.joda.time.LocalDate.parse(attributeValue);");
            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)

Aggregations

SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)78 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)48 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)42 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)37 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)34 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)29 Test (org.junit.Test)29 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)26 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)26 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)21 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)20 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)20 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)19 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)18 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)14 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)14 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)14 SysSyncActionLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto)13 SysSyncItemLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto)13 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)13