use of eu.bcvsolutions.idm.acc.domain.SynchronizationUnlinkedActionType 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);
}
}
}
Aggregations