Search in sources :

Example 1 with SecHubDataConfigurationUsageByName

use of com.mercedesbenz.sechub.commons.model.SecHubDataConfigurationUsageByName in project sechub by mercedes-benz.

the class SecHubFileStructureDataProviderBuilder method addAllUsages.

private void addAllUsages(MutableSecHubFileStructureDataProvider data, Optional<? extends SecHubDataConfigurationUsageByName> scanDefinitionObject, boolean mustHave) {
    if (!scanDefinitionObject.isPresent()) {
        if (mustHave) {
            new IllegalStateException("For scanType:" + scanType + " the configuration entry is missing.");
        }
        return;
    }
    SecHubDataConfigurationUsageByName usageByName = scanDefinitionObject.get();
    Set<String> names = usageByName.getNamesOfUsedDataConfigurationObjects();
    if (names.isEmpty()) {
        if (mustHave) {
            new SecHubRuntimeException("Confgiguration file problem. For scanType:" + scanType + " at least one data configuration must be referenced");
        }
    }
    data.addAcceptedReferenceNames(names);
}
Also used : SecHubRuntimeException(com.mercedesbenz.sechub.commons.model.SecHubRuntimeException) SecHubDataConfigurationUsageByName(com.mercedesbenz.sechub.commons.model.SecHubDataConfigurationUsageByName)

Aggregations

SecHubDataConfigurationUsageByName (com.mercedesbenz.sechub.commons.model.SecHubDataConfigurationUsageByName)1 SecHubRuntimeException (com.mercedesbenz.sechub.commons.model.SecHubRuntimeException)1