Search in sources :

Example 1 with SynchronizationMissingEntityActionType

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

the class AbstractSynchronizationExecutor method resolveAccountNotExistSituation.

/**
 * Resolve "Account doesn't exist in IDM" situation. Result can be UNLINKED or
 * UNMATCHED situations.
 *
 * @param context
 * @param systemEntity
 * @param icAttributes
 */
protected void resolveAccountNotExistSituation(SynchronizationContext context, SysSystemEntityDto systemEntity, List<IcAttribute> icAttributes) {
    Assert.notNull(context, "Context is required.");
    AbstractSysSyncConfigDto config = context.getConfig();
    SysSyncItemLogDto logItem = context.getLogItem();
    addToItemLog(logItem, "Account doesn't exist in IdM");
    DTO entity = findByCorrelationAttribute(systemAttributeMappingService.get(config.getCorrelationAttribute()), icAttributes, context);
    if (entity != null) {
        // Account not exist but, entity by correlation was
        // found (UNLINKED)
        context.addActionType(config.getUnlinkedAction().getAction());
        SynchronizationSituationType situation = SynchronizationSituationType.UNLINKED;
        if (StringUtils.hasLength(config.getUnlinkedActionWfKey())) {
            SynchronizationUnlinkedActionType unlinkedActionType = config.getUnlinkedAction();
            SynchronizationActionType action = unlinkedActionType.getAction();
            // We will start specific workflow
            startWorkflow(config.getUnlinkedActionWfKey(), situation, action, entity, context);
        } else {
            context.addEntityId(entity.getId()).addSystemEntity(systemEntity);
            resolveUnlinkedSituation(config.getUnlinkedAction(), context);
        }
    } else {
        // Account not exist and entity too (UNMATCHED)
        context.addActionType(config.getMissingEntityAction().getAction());
        SynchronizationSituationType situation = SynchronizationSituationType.MISSING_ENTITY;
        if (StringUtils.hasLength(config.getMissingEntityActionWfKey())) {
            SynchronizationMissingEntityActionType missingEntityAction = config.getMissingEntityAction();
            SynchronizationActionType action = missingEntityAction.getAction();
            // We will start specific workflow
            startWorkflow(config.getMissingEntityActionWfKey(), situation, action, entity, context);
        } else {
            resolveMissingEntitySituation(config.getMissingEntityAction(), context);
        }
    }
}
Also used : SynchronizationSituationType(eu.bcvsolutions.idm.acc.domain.SynchronizationSituationType) SynchronizationActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationActionType) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) SynchronizationUnlinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationUnlinkedActionType) SynchronizationMissingEntityActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationMissingEntityActionType)

Aggregations

SynchronizationActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationActionType)1 SynchronizationMissingEntityActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationMissingEntityActionType)1 SynchronizationSituationType (eu.bcvsolutions.idm.acc.domain.SynchronizationSituationType)1 SynchronizationUnlinkedActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationUnlinkedActionType)1 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)1 SysSyncItemLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto)1