Search in sources :

Example 1 with UseCaseAdmiUpdatesMappingConfiguration

use of com.mercedesbenz.sechub.sharedkernel.usecases.admin.config.UseCaseAdmiUpdatesMappingConfiguration in project sechub by mercedes-benz.

the class ScanMessageHandler method handleMappingConfigurationChanged.

@IsReceivingAsyncMessage(MessageID.MAPPING_CONFIGURATION_CHANGED)
@UseCaseAdmiUpdatesMappingConfiguration(@Step(number = 3, name = "Event handler", description = "Receives mapping configuration change event"))
private void handleMappingConfigurationChanged(DomainMessage request) {
    MappingMessage data = request.get(MessageDataKeys.CONFIG_MAPPING_DATA);
    String mappingId = data.getMappingId();
    MappingIdentifier found = MappingIdentifier.getIdentifierOrNull(mappingId);
    if (found == null) {
        LOG.error("Mapping identifier with id:{} does not exist!", mappingId);
        return;
    }
    /* filter only relevant parts - message may contain uninteresting stuff */
    if (!found.hasTypeContainedIn(MappingType.ADAPTER_CONFIGURATION, MappingType.COMMON_CONFIGURATION)) {
        LOG.debug("Mapping with id:{} is not relevant for cluster configuration and so ignored.", mappingId);
        return;
    }
    updateScanMappingService.updateScanMapping(mappingId, data.getMappingData());
}
Also used : MappingIdentifier(com.mercedesbenz.sechub.sharedkernel.mapping.MappingIdentifier) MappingMessage(com.mercedesbenz.sechub.sharedkernel.messaging.MappingMessage) UseCaseAdmiUpdatesMappingConfiguration(com.mercedesbenz.sechub.sharedkernel.usecases.admin.config.UseCaseAdmiUpdatesMappingConfiguration) IsReceivingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsReceivingAsyncMessage)

Aggregations

MappingIdentifier (com.mercedesbenz.sechub.sharedkernel.mapping.MappingIdentifier)1 IsReceivingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsReceivingAsyncMessage)1 MappingMessage (com.mercedesbenz.sechub.sharedkernel.messaging.MappingMessage)1 UseCaseAdmiUpdatesMappingConfiguration (com.mercedesbenz.sechub.sharedkernel.usecases.admin.config.UseCaseAdmiUpdatesMappingConfiguration)1