use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.
the class RoleSynchronizationExecutor method doUnlink.
/**
* Operation remove RoleAccount relations and linked roles
*
* @param account
* @param removeRoleRole
* @param log
* @param logItem
* @param actionLogs
*/
protected void doUnlink(AccAccountDto account, boolean removeRoleRole, SysSyncLogDto log, SysSyncItemLogDto logItem, List<SysSyncActionLogDto> actionLogs) {
EntityAccountFilter roleAccountFilter = new AccRoleAccountFilter();
roleAccountFilter.setAccountId(account.getId());
List<AccRoleAccountDto> roleAccounts = roleAccoutnService.find((AccRoleAccountFilter) roleAccountFilter, null).getContent();
if (roleAccounts.isEmpty()) {
addToItemLog(logItem, "Role account relation was not found!");
initSyncActionLog(SynchronizationActionType.UPDATE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
return;
}
addToItemLog(logItem, MessageFormat.format("Role-account relations to delete {0}", roleAccounts));
roleAccounts.stream().forEach(roleAccount -> {
// We will remove role account, but without delete connected
// account
roleAccoutnService.delete(roleAccount, false);
addToItemLog(logItem, MessageFormat.format("Role-account relation deleted (without call delete provisioning) (username: {0}, id: {1})", roleAccount.getRole(), roleAccount.getId()));
});
return;
}
use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.
the class AbstractProvisioningExecutor method resolveMappedAttributes.
/**
* Return all mapped attributes for this account (include overloaded
* attributes)
*
* @param uid
* @param account
* @param entity
* @param system
* @param entityType
* @return
*/
@Override
public List<AttributeMapping> resolveMappedAttributes(AccAccountDto account, DTO dto, SysSystemDto system, SystemEntityType entityType) {
EntityAccountFilter filter = this.createEntityAccountFilter();
filter.setEntityId(dto.getId());
filter.setSystemId(system.getId());
filter.setOwnership(Boolean.TRUE);
filter.setAccountId(account.getId());
List<? extends EntityAccountDto> entityAccoutnList = this.getEntityAccountService().find(filter, null).getContent();
if (entityAccoutnList == null) {
return null;
}
// All identity account with flag ownership on true
// All role system attributes (overloading) for this uid and same system
List<SysRoleSystemAttributeDto> roleSystemAttributesAll = findOverloadingAttributes(dto, system, entityAccoutnList, entityType);
// All default mapped attributes from system
List<? extends AttributeMapping> defaultAttributes = findAttributeMappings(system, entityType);
// Final list of attributes use for provisioning
return compileAttributes(defaultAttributes, roleSystemAttributesAll, entityType);
}
use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.
the class AbstractProvisioningExecutor method doProvisioning.
@Override
public void doProvisioning(AccAccountDto account) {
Assert.notNull(account);
EntityAccountFilter filter = createEntityAccountFilter();
filter.setAccountId(account.getId());
List<? extends EntityAccountDto> entityAccoutnList = getEntityAccountService().find(filter, null).getContent();
if (entityAccoutnList == null) {
return;
}
entityAccoutnList.stream().filter(entityAccount -> {
return entityAccount.isOwnership();
}).forEach((entityAccount) -> {
doProvisioning(account, getService().get(entityAccount.getEntity()));
});
}
use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.
the class AbstractProvisioningExecutor method getEntityByAccount.
protected UUID getEntityByAccount(UUID accountId, UUID systemId) {
EntityAccountFilter entityAccountFilter = createEntityAccountFilter();
entityAccountFilter.setAccountId(accountId);
entityAccountFilter.setSystemId(systemId);
entityAccountFilter.setOwnership(Boolean.TRUE);
List<? extends EntityAccountDto> entityAccounts = this.getEntityAccountService().find(entityAccountFilter, null).getContent();
if (entityAccounts.isEmpty()) {
return null;
} else {
// ownership) have same entity!
return entityAccounts.get(0).getEntity();
}
}
use of eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter in project CzechIdMng by bcvsolutions.
the class ContractSynchronizationExecutor method doUnlink.
/**
* Operation remove IdentityContractAccount relations and linked roles
*
* @param account
* @param removeIdentityContractIdentityContract
* @param log
* @param logItem
* @param actionLogs
*/
protected void doUnlink(AccAccountDto account, boolean removeIdentityContractIdentityContract, SysSyncLogDto log, SysSyncItemLogDto logItem, List<SysSyncActionLogDto> actionLogs) {
EntityAccountFilter entityAccountFilter = new AccContractAccountFilter();
entityAccountFilter.setAccountId(account.getId());
List<AccContractAccountDto> entityAccounts = contractAccoutnService.find((AccContractAccountFilter) entityAccountFilter, null).getContent();
if (entityAccounts.isEmpty()) {
addToItemLog(logItem, "Contract-account relation was not found!");
initSyncActionLog(SynchronizationActionType.UPDATE_ENTITY, OperationResultType.WARNING, logItem, log, actionLogs);
return;
}
addToItemLog(logItem, MessageFormat.format("Contract-account relations to delete {0}", entityAccounts));
entityAccounts.stream().forEach(entityAccount -> {
// We will remove contract account, but without delete connected
// account
contractAccoutnService.delete(entityAccount, false);
addToItemLog(logItem, MessageFormat.format("Contract-account relation deleted (without call delete provisioning) (contract id: {0}, contract-account id: {1})", entityAccount.getContract(), entityAccount.getId()));
});
return;
}
Aggregations