use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class SysSystemMappingServiceValidationTest method testSystemMappingValidationMissingIdentifier.
@Test(expected = ResultCodeException.class)
public void testSystemMappingValidationMissingIdentifier() {
SysSystemDto system = createSystem();
SysSchemaObjectClassDto schema = createSchema(system.getId());
SysSystemMappingDto mapping = createMapping(schema.getId(), SystemOperationType.PROVISIONING);
SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(schema.getId());
createAttributeMapping(mapping.getId(), schemaAttribute.getId(), false, "");
mappingService.validate(mapping.getId());
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class GenerateSchemaWithEavTest method initData.
private SysSystemDto initData() {
// create test system
SysSystemDto system = helper.createSystem(TestSchemaResource.TABLE_NAME, null, null, "NAME");
Assert.assertNotNull(system);
// generate schema for system
List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
// Create synchronization mapping
SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
syncSystemMapping.setName("default_generate_schema_" + System.currentTimeMillis());
syncSystemMapping.setEntityType(SystemEntityType.IDENTITY);
syncSystemMapping.setOperationType(SystemOperationType.SYNCHRONIZATION);
syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
createMapping(system, syncMapping);
return system;
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class IdentitySyncTest method initData.
private SysSystemDto initData() {
// create test system
SysSystemDto system = helper.createSystem(TestResource.TABLE_NAME);
Assert.assertNotNull(system);
// generate schema for system
List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
// Create synchronization mapping
SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
syncSystemMapping.setName("default_" + System.currentTimeMillis());
syncSystemMapping.setEntityType(SystemEntityType.IDENTITY);
syncSystemMapping.setOperationType(SystemOperationType.SYNCHRONIZATION);
syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
createMapping(system, syncMapping);
this.getBean().initIdentityData();
return system;
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class TreeSynchronizationExecutor method getValueByMappedAttribute.
@Override
protected Object getValueByMappedAttribute(AttributeMapping attribute, List<IcAttribute> icAttributes, SynchronizationContext context) {
Object transformedValue = super.getValueByMappedAttribute(attribute, icAttributes, context);
if (transformedValue != null && PARENT_FIELD.equals(attribute.getIdmPropertyName())) {
String parentUid = transformedValue.toString();
SysSystemMappingDto systemMapping = systemMappingService.get(((SysSystemAttributeMappingDto) attribute).getSystemMapping());
SysSchemaObjectClassDto schemaObjectClass = schemaObjectClassService.get(systemMapping.getObjectClass());
UUID systemId = schemaObjectClass.getSystem();
// Find account by UID from parent field
AccAccountFilter accountFilter = new AccAccountFilter();
accountFilter.setUid(parentUid);
accountFilter.setSystemId(systemId);
transformedValue = null;
List<AccAccountDto> parentAccounts = accountService.find(accountFilter, null).getContent();
if (!parentAccounts.isEmpty()) {
UUID parentAccount = parentAccounts.get(0).getId();
// Find relation between tree and account
AccTreeAccountFilter treeAccountFilter = new AccTreeAccountFilter();
treeAccountFilter.setAccountId(parentAccount);
List<AccTreeAccountDto> treeAccounts = treeAccountService.find(treeAccountFilter, null).getContent();
if (!treeAccounts.isEmpty()) {
// Find parent tree node by ID
// TODO: resolve more treeAccounts situations
// parent uuid - we are working with dtos
transformedValue = treeAccounts.get(0).getTreeNode();
} else {
LOG.warn("For parent UID: [{}] on system ID [{}] and acc account: [{}], was not found tree accounts! Return null value in parent!!", parentUid, systemId, parentAccount);
throw new ProvisioningException(AccResultCode.SYNCHRONIZATION_TREE_PARENT_TREE_ACCOUNT_NOT_FOUND, ImmutableMap.of("parentUid", parentUid, "systemId", systemId, "parentAccount", parentAccount));
}
} else {
LOG.warn("For parent UID: [{}] on system ID [{}], was not found parents account! Return null value in parent!!", parentUid, systemId);
throw new ProvisioningException(AccResultCode.SYNCHRONIZATION_TREE_PARENT_ACCOUNT_NOT_FOUND, ImmutableMap.of("parentUid", parentUid, "systemId", systemId));
}
}
return transformedValue;
}
use of eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto in project CzechIdMng by bcvsolutions.
the class AccountManagementTest method initIdentityData.
private SysSystemDto initIdentityData() {
// create test system
SysSystemDto system = helper.createSystem(TestResource.TABLE_NAME);
Assert.assertNotNull(system);
// generate schema for system
List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
// Create mapping
SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
syncSystemMapping.setName("default_" + System.currentTimeMillis());
syncSystemMapping.setEntityType(SystemEntityType.IDENTITY);
syncSystemMapping.setOperationType(SystemOperationType.PROVISIONING);
syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
createIdentityMapping(system, syncMapping);
return system;
}
Aggregations