Search in sources :

Example 6 with AccContractSliceAccountDto

use of eu.bcvsolutions.idm.acc.dto.AccContractSliceAccountDto in project CzechIdMng by bcvsolutions.

the class ContractSliceSynchronizationExecutor 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 AccContractSliceAccountFilter();
    entityAccountFilter.setAccountId(account.getId());
    List<AccContractSliceAccountDto> entityAccounts = contractAccoutnService.find((AccContractSliceAccountFilter) entityAccountFilter, null).getContent();
    if (entityAccounts.isEmpty()) {
        addToItemLog(logItem, "Warning! - 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.getSlice(), entityAccount.getId()));
    });
    return;
}
Also used : EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) AccContractSliceAccountDto(eu.bcvsolutions.idm.acc.dto.AccContractSliceAccountDto) AccContractSliceAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccContractSliceAccountFilter)

Example 7 with AccContractSliceAccountDto

use of eu.bcvsolutions.idm.acc.dto.AccContractSliceAccountDto in project CzechIdMng by bcvsolutions.

the class ContractSliceAccountSaveProcessor method process.

@Override
public EventResult<AccContractSliceAccountDto> process(EntityEvent<AccContractSliceAccountDto> event) {
    AccContractSliceAccountDto entity = event.getContent();
    UUID account = entity.getAccount();
    Assert.notNull(account, "Account cannot be null!");
    event.setContent(service.saveInternal(entity));
    return new DefaultEventResult<>(event, this);
}
Also used : DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) AccContractSliceAccountDto(eu.bcvsolutions.idm.acc.dto.AccContractSliceAccountDto) UUID(java.util.UUID)

Aggregations

AccContractSliceAccountDto (eu.bcvsolutions.idm.acc.dto.AccContractSliceAccountDto)7 AccContractSliceAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccContractSliceAccountFilter)6 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)5 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)4 SysSyncContractConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto)4 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)4 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)4 IdmContractSliceDto (eu.bcvsolutions.idm.core.api.dto.IdmContractSliceDto)4 IdmContractSliceFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmContractSliceFilter)4 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)4 Test (org.junit.Test)4 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)2 UUID (java.util.UUID)2 EntityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter)1 TestContractSliceResource (eu.bcvsolutions.idm.acc.entity.TestContractSliceResource)1 AccountEvent (eu.bcvsolutions.idm.acc.event.AccountEvent)1