Search in sources :

Example 6 with AttributeMappingStrategyType

use of eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType in project CzechIdMng by bcvsolutions.

the class AbstractProvisioningExecutor method compileAttributes.

/**
 * Create final list of attributes for provisioning.
 *
 * @param identityAccount
 * @param defaultAttributes
 * @param overloadingAttributes
 * @return
 */
@Override
public List<AttributeMapping> compileAttributes(List<? extends AttributeMapping> defaultAttributes, List<SysRoleSystemAttributeDto> overloadingAttributes, SystemEntityType entityType) {
    Assert.notNull(overloadingAttributes, "List of overloading attributes cannot be null!");
    List<AttributeMapping> finalAttributes = new ArrayList<>();
    if (defaultAttributes == null) {
        return null;
    }
    defaultAttributes.stream().forEach(defaultAttribute -> {
        for (AttributeMappingStrategyType strategy : AttributeMappingStrategyType.values()) {
            finalAttributes.addAll(compileAtributeForStrategy(strategy, defaultAttribute, overloadingAttributes));
        }
    });
    // Validate attributes on incompatible strategies
    validateAttributesStrategy(finalAttributes);
    return finalAttributes;
}
Also used : AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSystemAttributeMapping(eu.bcvsolutions.idm.acc.entity.SysSystemAttributeMapping) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) ArrayList(java.util.ArrayList)

Example 7 with AttributeMappingStrategyType

use of eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType in project CzechIdMng by bcvsolutions.

the class AbstractSynchronizationExecutor method canSetValue.

/**
 * Return true if can be value set to this entity for this mapped attribute.
 *
 * @param uid
 * @param attribute
 * @param entity
 * @param create
 *            (create or update entity situation)
 * @return
 */
protected boolean canSetValue(String uid, SysSystemAttributeMappingDto attribute, DTO dto, boolean create) {
    Assert.notNull(attribute);
    AttributeMappingStrategyType strategyType = attribute.getStrategyType();
    switch(strategyType) {
        case CREATE:
            {
                return create;
            }
        case SET:
            {
                return true;
            }
        case WRITE_IF_NULL:
            {
                Object value = systemAttributeMappingService.getAttributeValue(uid, dto, attribute);
                return value == null ? true : false;
            }
        default:
            {
                return false;
            }
    }
}
Also used : AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject)

Example 8 with AttributeMappingStrategyType

use of eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingServiceTest method idmPropertyNameFilterTest.

@Test
public void idmPropertyNameFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    AttributeMappingStrategyType strategyType = AttributeMappingStrategyType.MERGE;
    SysSystemDto system = createSystem();
    SysSchemaObjectClassDto objectClass = createObjectClass(system);
    SysSystemMappingDto systemMapping = testHelper.createMappingSystem(entityType, objectClass);
    SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(objectClass);
    SysSystemAttributeMappingDto attributeMapping1 = createAttributeMappingSystem(systemMapping, strategyType, schemaAttribute.getId());
    attributeMapping1.setIdmPropertyName("PropName31");
    attributeMappingService.save(attributeMapping1);
    SysSystemAttributeMappingDto attributeMapping2 = createAttributeMappingSystem(systemMapping, AttributeMappingStrategyType.CREATE, schemaAttribute.getId());
    attributeMapping2.setIdmPropertyName("PropName42");
    attributeMappingService.save(attributeMapping2);
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setIdmPropertyName("PropName4");
    Page<SysSystemAttributeMappingDto> result = attributeMappingService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(attributeMapping2));
    assertFalse(result.getContent().contains(attributeMapping1));
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 9 with AttributeMappingStrategyType

use of eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingServiceTest method systemMappingIdFilterTest.

@Test
public void systemMappingIdFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    AttributeMappingStrategyType strategyType = AttributeMappingStrategyType.MERGE;
    SysSystemDto system = createSystem();
    SysSchemaObjectClassDto objectClass = createObjectClass(system);
    SysSystemMappingDto systemMapping1 = testHelper.createMappingSystem(entityType, objectClass);
    SysSystemMappingDto systemMapping2 = testHelper.createMappingSystem(entityType, objectClass);
    SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(objectClass);
    SysSystemAttributeMappingDto attributeMapping1 = createAttributeMappingSystem(systemMapping1, strategyType, schemaAttribute.getId());
    SysSystemAttributeMappingDto attributeMapping2 = createAttributeMappingSystem(systemMapping2, strategyType, schemaAttribute.getId());
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setSystemMappingId(systemMapping1.getId());
    Page<SysSystemAttributeMappingDto> result = attributeMappingService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(attributeMapping1));
    assertFalse(result.getContent().contains(attributeMapping2));
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)9 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)7 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)7 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)7 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)7 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)7 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)7 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)7 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)6 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)6 Test (org.junit.Test)6 AttributeMapping (eu.bcvsolutions.idm.acc.domain.AttributeMapping)2 SysSystemAttributeMapping (eu.bcvsolutions.idm.acc.entity.SysSystemAttributeMapping)2 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)2 ArrayList (java.util.ArrayList)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 AccResultCode (eu.bcvsolutions.idm.acc.domain.AccResultCode)1 AccountType (eu.bcvsolutions.idm.acc.domain.AccountType)1 ProvisioningContext (eu.bcvsolutions.idm.acc.domain.ProvisioningContext)1