use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.
the class AbstractSynchronizationExecutor method getEntityByAccount.
/**
* Find entity by account
*
* @param account
* @param log
* @param logItem
* @param actionLogs
* @return
*/
protected UUID getEntityByAccount(UUID accountId) {
EntityAccountFilter entityAccountFilter = createEntityAccountFilter();
entityAccountFilter.setAccountId(accountId);
entityAccountFilter.setOwnership(Boolean.TRUE);
@SuppressWarnings("unchecked") List<EntityAccountDto> entityAccounts = this.getEntityAccountService().find((BaseFilter) entityAccountFilter, null).getContent();
if (entityAccounts.isEmpty()) {
return null;
} else {
// ownership) have same identity!
return entityAccounts.get(0).getEntity();
}
}
use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.
the class IdentitySynchronizationExecutor method doUnlink.
/**
* Operation remove IdentityAccount relations and linked roles
*
* @param account
* @param removeIdentityRole
* @param log
* @param logItem
* @param actionLogs
*/
@Override
protected void doUnlink(AccAccountDto account, boolean removeIdentityRole, SysSyncLogDto log, SysSyncItemLogDto logItem, List<SysSyncActionLogDto> actionLogs) {
EntityAccountFilter identityAccountFilter = new AccIdentityAccountFilter();
identityAccountFilter.setAccountId(account.getId());
List<AccIdentityAccountDto> identityAccounts = identityAccoutnService.find((AccIdentityAccountFilter) identityAccountFilter, null).getContent();
if (identityAccounts.isEmpty()) {
addToItemLog(logItem, "Identity account relation was not found!");
initSyncActionLog(SynchronizationActionType.UPDATE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
return;
}
addToItemLog(logItem, MessageFormat.format("Identity-account relations to delete {0}", identityAccounts));
identityAccounts.stream().forEach(identityAccount -> {
// We will remove identity account, but without delete connected
// account
identityAccoutnService.delete(identityAccount, false);
addToItemLog(logItem, MessageFormat.format("Identity-account relation deleted (without call delete provisioning) (username: {0}, id: {1})", identityAccount.getIdentity(), identityAccount.getId()));
UUID identityRole = identityAccount.getIdentityRole();
if (removeIdentityRole && identityRole != null) {
// We will remove connected identity role
identityRoleService.deleteById(identityRole);
addToItemLog(logItem, MessageFormat.format("Identity-role relation deleted (id: {0})", identityRole));
}
});
return;
}
Aggregations