use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningServiceTest method doIdentityProvisioningStrategyMergeException.
// Expected PROVISIONING_MERGE_ATTRIBUTE_IS_NOT_MULTIVALUE
@Test(expected = ProvisioningException.class)
public void doIdentityProvisioningStrategyMergeException() {
IdmIdentityDto identity = idmIdentityService.getByUsername(IDENTITY_USERNAME);
AccIdentityAccountFilter filter = new AccIdentityAccountFilter();
filter.setIdentityId(identity.getId());
AccIdentityAccountDto accountIdentityOne = identityAccoutnService.find(filter, null).getContent().get(0);
SysSystemAttributeMappingFilter filterSchemaAttr = new SysSystemAttributeMappingFilter();
filterSchemaAttr.setIdmPropertyName("email");
filterSchemaAttr.setSystemId(accountService.get(accountIdentityOne.getAccount()).getSystem());
SysSystemAttributeMappingDto attributeHandling = systemAttributeMappingService.find(filterSchemaAttr, null).getContent().get(0);
attributeHandling.setEntityAttribute(true);
attributeHandling.setStrategyType(AttributeMappingStrategyType.MERGE);
SysSchemaAttributeDto schemaAttributeDto = schemaAttributeService.get(attributeHandling.getSchemaAttribute());
schemaAttributeDto.setMultivalued(false);
schemaAttributeService.save(schemaAttributeDto);
systemAttributeMappingService.save(attributeHandling);
// Do provisioning
provisioningService.doProvisioning(identity);
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto 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));
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto 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));
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSchemaAttributeService method clone.
@Override
public SysSchemaAttributeDto clone(UUID id) {
SysSchemaAttributeDto original = this.get(id);
Assert.notNull(original, "Schema attribute must be found!");
original.setId(null);
EntityUtils.clearAuditFields(original);
return original;
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingService method getValueByMappedAttribute.
@Override
public Object getValueByMappedAttribute(AttributeMapping attribute, List<IcAttribute> icAttributes) {
Object icValue = null;
Optional<IcAttribute> optionalIcAttribute = icAttributes.stream().filter(icAttribute -> {
SysSchemaAttributeDto schemaAttributeDto = getSchemaAttribute(attribute);
return schemaAttributeDto.getName().equals(icAttribute.getName());
}).findFirst();
if (optionalIcAttribute.isPresent()) {
IcAttribute icAttribute = optionalIcAttribute.get();
if (icAttribute.isMultiValue()) {
icValue = icAttribute.getValues();
} else {
icValue = icAttribute.getValue();
}
}
Object transformedValue = this.transformValueFromResource(icValue, attribute, icAttributes);
return transformedValue;
}
Aggregations