Search in sources :

Example 26 with SynchronizationContext

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

the class DefaultSynchronizationService method resolveLinkedSituation.

@Override
public SysSyncItemLogDto resolveLinkedSituation(String uid, SystemEntityType entityType, List<IcAttribute> icAttributes, UUID accountId, UUID configId, String actionType) {
    Assert.notNull(uid, "Uid is required.");
    Assert.notNull(entityType, "Entity type is required.");
    Assert.notNull(icAttributes, "Connector attribues are required.");
    Assert.notNull(configId, "Configuration identifier is required.");
    Assert.notNull(actionType, "Action type is required.");
    Assert.notNull(accountId, "Account identifier is required.");
    SysSyncItemLogDto itemLog = new SysSyncItemLogDto();
    AbstractSysSyncConfigDto config = synchronizationConfigService.get(configId);
    SysSystemMappingDto mapping = systemMappingService.get(config.getSystemMapping());
    AccAccountDto account = accountService.get(accountId);
    SysSystemAttributeMappingFilter attributeHandlingFilter = new SysSystemAttributeMappingFilter();
    attributeHandlingFilter.setSystemMappingId(mapping.getId());
    List<SysSystemAttributeMappingDto> mappedAttributes = attributeHandlingService.find(attributeHandlingFilter, null).getContent();
    // Little workaround, we have only IcAttributes ... we create IcObject manually
    IcConnectorObjectImpl icObject = new IcConnectorObjectImpl();
    icObject.setAttributes(icAttributes);
    icObject.setUidValue(uid);
    SynchronizationContext context = new SynchronizationContext();
    // 
    context.addUid(uid).addAccount(// 
    account).addConfig(// 
    config).addEntityType(// 
    entityType).addLogItem(// 
    itemLog).addMappedAttributes(// 
    mappedAttributes).addIcObject(// 
    icObject);
    getSyncExecutor(entityType, configId).resolveLinkedSituation(SynchronizationLinkedActionType.valueOf(actionType), context);
    return itemLog;
}
Also used : AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)

Example 27 with SynchronizationContext

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

the class DefaultSynchronizationService method resolveUnlinkedSituation.

@Override
public SysSyncItemLogDto resolveUnlinkedSituation(String uid, SystemEntityType entityType, UUID entityId, UUID configId, String actionType, List<IcAttribute> icAttributes) {
    Assert.notNull(uid, "Uid is required.");
    Assert.notNull(entityType, "Entity type is required.");
    Assert.notNull(configId, "Configuration identifier is required.");
    Assert.notNull(actionType, "Action type is required.");
    Assert.notNull(entityId, "Entity identifier is required.");
    AbstractSysSyncConfigDto config = synchronizationConfigService.get(configId);
    SysSystemMappingDto mapping = systemMappingService.get(config.getSystemMapping());
    SysSchemaObjectClassDto sysSchemaObjectClassDto = schemaObjectClassService.get(mapping.getObjectClass());
    SysSystemDto system = DtoUtils.getEmbedded(sysSchemaObjectClassDto, SysSchemaObjectClass_.system);
    SysSystemEntityDto systemEntity = findSystemEntity(uid, system, entityType);
    SysSyncItemLogDto itemLog = new SysSyncItemLogDto();
    SysSystemAttributeMappingFilter attributeHandlingFilter = new SysSystemAttributeMappingFilter();
    attributeHandlingFilter.setSystemMappingId(mapping.getId());
    List<SysSystemAttributeMappingDto> mappedAttributes = attributeHandlingService.find(attributeHandlingFilter, null).getContent();
    // Little workaround, we have only IcAttributes ... we create IcObject manually
    IcConnectorObjectImpl icObject = new IcConnectorObjectImpl();
    icObject.setAttributes(icAttributes);
    icObject.setUidValue(uid);
    SynchronizationContext context = new SynchronizationContext();
    // 
    context.addUid(uid).addSystem(// 
    system).addConfig(// 
    config).addEntityType(// 
    entityType).addEntityId(// 
    entityId).addLogItem(// 
    itemLog).addSystemEntity(// 
    systemEntity).addIcObject(// 
    icObject).addMappedAttributes(// 
    mappedAttributes);
    getSyncExecutor(entityType, configId).resolveUnlinkedSituation(SynchronizationUnlinkedActionType.valueOf(actionType), context);
    return itemLog;
}
Also used : AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Aggregations

SynchronizationContext (eu.bcvsolutions.idm.acc.domain.SynchronizationContext)27 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)20 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)19 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)17 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)17 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)15 SysSyncItemLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto)15 SysSyncActionLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto)14 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)14 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)13 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)13 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)13 AttributeMapping (eu.bcvsolutions.idm.acc.domain.AttributeMapping)12 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)12 UUID (java.util.UUID)10 ImmutableMap (com.google.common.collect.ImmutableMap)9 AccResultCode (eu.bcvsolutions.idm.acc.domain.AccResultCode)9 OperationResultType (eu.bcvsolutions.idm.acc.domain.OperationResultType)9 SynchronizationActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationActionType)9 EntityAccountDto (eu.bcvsolutions.idm.acc.dto.EntityAccountDto)9