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();
}
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());
}
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()));
}
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();
}
Aggregations