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);
}
});
}
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);
}
});
}
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;
}
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);
}
});
}
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);
}
});
}
Aggregations