Search in sources :

Example 1 with ModuleNotDisableableException

use of eu.bcvsolutions.idm.core.exception.ModuleNotDisableableException in project CzechIdMng by bcvsolutions.

the class ModuleDisableProcessor method process.

@Override
public EventResult<ModuleDescriptorDto> process(EntityEvent<ModuleDescriptorDto> event) {
    ModuleDescriptorDto moduleDescriptor = event.getContent();
    String moduleId = moduleDescriptor.getId();
    // validation
    if (!moduleDescriptor.isDisableable()) {
        throw new ModuleNotDisableableException(moduleId);
    }
    // disable module
    String propertyName = moduleService.getModuleConfigurationProperty(moduleId, ConfigurationService.PROPERTY_ENABLED);
    configurationService.setBooleanValue(propertyName, false);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : ModuleNotDisableableException(eu.bcvsolutions.idm.core.exception.ModuleNotDisableableException) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) ModuleDescriptorDto(eu.bcvsolutions.idm.core.api.dto.ModuleDescriptorDto)

Aggregations

ModuleDescriptorDto (eu.bcvsolutions.idm.core.api.dto.ModuleDescriptorDto)1 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)1 ModuleNotDisableableException (eu.bcvsolutions.idm.core.exception.ModuleNotDisableableException)1