use of eu.bcvsolutions.idm.acc.dto.AccAccountDto 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);
Assert.notNull(entityType);
Assert.notNull(icAttributes);
Assert.notNull(configId);
Assert.notNull(actionType);
Assert.notNull(accountId);
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).resolveLinkedSituation(SynchronizationLinkedActionType.valueOf(actionType), context);
return itemLog;
}
use of eu.bcvsolutions.idm.acc.dto.AccAccountDto in project CzechIdMng by bcvsolutions.
the class DefaultSynchronizationService method resolveMissingAccountSituation.
@Override
public SysSyncItemLogDto resolveMissingAccountSituation(String uid, SystemEntityType entityType, UUID accountId, UUID configId, String actionType) {
Assert.notNull(uid);
Assert.notNull(entityType);
Assert.notNull(configId);
Assert.notNull(actionType);
Assert.notNull(accountId);
AbstractSysSyncConfigDto config = synchronizationConfigService.get(configId);
SysSystemMappingDto mapping = systemMappingService.get(config.getSystemMapping());
AccAccountDto account = accountService.get(accountId);
SysSchemaObjectClassDto sysSchemaObjectClassDto = schemaObjectClassService.get(mapping.getObjectClass());
SysSystemDto system = DtoUtils.getEmbedded(sysSchemaObjectClassDto, SysSchemaObjectClass_.system, SysSystemDto.class);
SysSyncItemLogDto itemLog = new SysSyncItemLogDto();
SynchronizationContext context = new SynchronizationContext();
context.addUid(uid).addSystem(system).addConfig(config).addEntityType(entityType).addAccount(account).addLogItem(itemLog);
getSyncExecutor(entityType).resolveMissingAccountSituation(ReconciliationMissingAccountActionType.valueOf(actionType), context);
return itemLog;
}
use of eu.bcvsolutions.idm.acc.dto.AccAccountDto in project CzechIdMng by bcvsolutions.
the class IdentitySynchronizationExecutor method doUpdateEntity.
/**
* Fill data from IC attributes to entity (EAV and confidential storage too)
*
* @param account
* @param entityType
* @param uid
* @param icAttributes
* @param mappedAttributes
* @param log
* @param logItem
* @param actionLogs
*/
protected void doUpdateEntity(SynchronizationContext context) {
String uid = context.getUid();
SysSyncLogDto log = context.getLog();
SysSyncItemLogDto logItem = context.getLogItem();
List<SysSyncActionLogDto> actionLogs = context.getActionLogs();
List<SysSystemAttributeMappingDto> mappedAttributes = context.getMappedAttributes();
AccAccountDto account = context.getAccount();
List<IcAttribute> icAttributes = context.getIcObject().getAttributes();
SystemEntityType entityType = context.getEntityType();
UUID entityId = getEntityByAccount(account.getId());
IdmIdentityDto identity = null;
if (entityId != null) {
identity = identityService.get(entityId);
}
if (identity != null) {
// Update identity
identity = fillEntity(mappedAttributes, uid, icAttributes, identity, false, context);
identity = this.save(identity, true);
// Update extended attribute (entity must be persisted first)
updateExtendedAttributes(mappedAttributes, uid, icAttributes, identity, false, context);
// Update confidential attribute (entity must be persisted
// first)
updateConfidentialAttributes(mappedAttributes, uid, icAttributes, identity, false, context);
// Identity Updated
addToItemLog(logItem, MessageFormat.format("Identity with id {0} was updated", identity.getId()));
if (logItem != null) {
logItem.setDisplayName(identity.getUsername());
}
// Call provisioning for entity
this.callProvisioningForEntity(identity, entityType, logItem);
return;
} else {
addToItemLog(logItem, "Identity account relation (with ownership = true) was not found!");
initSyncActionLog(SynchronizationActionType.UPDATE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
return;
}
}
use of eu.bcvsolutions.idm.acc.dto.AccAccountDto in project CzechIdMng by bcvsolutions.
the class RoleProvisioningExecutor method doProvisioning.
public void doProvisioning(AccAccountDto account) {
Assert.notNull(account);
AccRoleAccountFilter filter = new AccRoleAccountFilter();
filter.setAccountId(account.getId());
List<AccRoleAccountDto> entityAccoutnList = roleAccountService.find(filter, null).getContent();
if (entityAccoutnList == null) {
return;
}
entityAccoutnList.stream().filter(entityAccount -> {
return entityAccount.isOwnership();
}).forEach((roleAccount) -> {
doProvisioning(account, DtoUtils.getEmbedded(roleAccount, AccRoleAccount_.role, IdmRoleDto.class));
});
}
use of eu.bcvsolutions.idm.acc.dto.AccAccountDto in project CzechIdMng by bcvsolutions.
the class TreeProvisioningExecutor method doProvisioning.
public void doProvisioning(AccAccountDto account) {
Assert.notNull(account);
AccTreeAccountFilter filter = new AccTreeAccountFilter();
filter.setAccountId(account.getId());
List<AccTreeAccountDto> treeAccoutnList = treeAccountService.find(filter, null).getContent();
if (treeAccoutnList == null) {
return;
}
treeAccoutnList.stream().filter(treeAccount -> {
return treeAccount.isOwnership();
}).forEach((treeAccount) -> {
doProvisioning(account, DtoUtils.getEmbedded(treeAccount, AccTreeAccount_.treeNode, IdmTreeNodeDto.class));
});
}
Aggregations