Search in sources :

Example 1 with SysProvisioningBreakConfigFilter

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

the class SystemExportBulkActionIntegrationTest method findBreaks.

private List<SysProvisioningBreakConfigDto> findBreaks(SysSystemDto system) {
    SysProvisioningBreakConfigFilter filter = new SysProvisioningBreakConfigFilter();
    filter.setSystemId(system.getId());
    return provisioningBreakService.find(filter, null).getContent();
}
Also used : SysProvisioningBreakConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningBreakConfigFilter)

Example 2 with SysProvisioningBreakConfigFilter

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

the class SystemExportBulkAction method exportBreakConfig.

/**
 * Export break configurations
 *
 * @param systemId
 */
private void exportBreakConfig(UUID systemId) {
    SysProvisioningBreakConfigFilter provisioningBreakConfigFilter = new SysProvisioningBreakConfigFilter();
    provisioningBreakConfigFilter.setSystemId(systemId);
    List<SysProvisioningBreakConfigDto> breakConfigs = provisioningBreakService.find(provisioningBreakConfigFilter, null).getContent();
    if (breakConfigs.isEmpty()) {
        provisioningBreakService.export(ExportManager.BLANK_UUID, getBatch());
    }
    breakConfigs.forEach(breakConfig -> {
        provisioningBreakService.export(breakConfig.getId(), getBatch());
    });
    // Set parent field -> set authoritative mode.
    this.getExportManager().setAuthoritativeMode(SysSchemaObjectClass_.system.getName(), "systemId", SysProvisioningBreakConfigDto.class, getBatch());
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) SysProvisioningBreakConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningBreakConfigFilter)

Example 3 with SysProvisioningBreakConfigFilter

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

the class DefaultSysProvisioningBreakConfigService method save.

@Override
public SysProvisioningBreakConfigDto save(SysProvisioningBreakConfigDto dto, BasePermission... permission) {
    // check global configuration
    if (dto.getGlobalConfiguration() != null && dto.getGlobalConfiguration()) {
        throw new ProvisioningException(AccResultCode.PROVISIONING_BREAK_GLOBAL_CONFIG_SAVE, ImmutableMap.of("operationType", dto.getOperationType()));
    }
    // check if for same system doesn't exist same operation type
    SysProvisioningBreakConfigFilter filter = new SysProvisioningBreakConfigFilter();
    filter.setSystemId(dto.getSystem());
    filter.setOperationType(dto.getOperationType());
    List<SysProvisioningBreakConfigDto> similarConfigs = this.find(filter, null).getContent();
    boolean existSimilar = similarConfigs.stream().filter(config -> !config.getId().equals(dto.getId())).findFirst().isPresent();
    if (!existSimilar) {
        return super.save(dto, permission);
    }
    throw new ProvisioningException(AccResultCode.PROVISIONING_BREAK_OPERATION_EXISTS, ImmutableMap.of("operationType", dto.getOperationType(), "systemId", dto.getSystem()));
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) SysProvisioningBreakConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningBreakConfigFilter)

Example 4 with SysProvisioningBreakConfigFilter

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

the class DefaultSysProvisioningBreakConfigService method getConfig.

@Override
public SysProvisioningBreakConfigDto getConfig(ProvisioningEventType operationType, UUID systemId) {
    SysProvisioningBreakConfigFilter filter = new SysProvisioningBreakConfigFilter();
    filter.setOperationType(operationType);
    filter.setSystemId(systemId);
    List<SysProvisioningBreakConfigDto> configs = this.find(filter, null).getContent();
    // 
    if (configs.isEmpty()) {
        return null;
    }
    // must exists only one configs for operation type and system id
    return configs.stream().findFirst().get();
}
Also used : SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) SysProvisioningBreakConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningBreakConfigFilter)

Aggregations

SysProvisioningBreakConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningBreakConfigFilter)4 SysProvisioningBreakConfigDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto)3 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)1