use of com.mercedesbenz.sechub.commons.model.SecHubDataConfigurationObjectInfo in project sechub by mercedes-benz.
the class AbstractProductExecutor method configureSourceCodeHandlingIfNecessary.
private void configureSourceCodeHandlingIfNecessary(ProductExecutorData data) {
if (scanType != ScanType.CODE_SCAN) {
return;
}
// the information about paths is interesting for debugging but also necessary
// for our integration tests - see mocked_setup.json
Set<String> paths = new LinkedHashSet<>();
data.codeUploadFileSystemFolderPaths = paths;
SecHubConfiguration configuration = data.getSechubExecutionContext().getConfiguration();
Optional<SecHubCodeScanConfiguration> codeScanOpt = configuration.getCodeScan();
if (!codeScanOpt.isPresent()) {
return;
}
SecHubCodeScanConfiguration codeScan = codeScanOpt.get();
addFileSystemParts(paths, codeScan);
Set<String> usedNames = codeScan.getNamesOfUsedDataConfigurationObjects();
if (usedNames.isEmpty()) {
return;
}
List<SecHubDataConfigurationObjectInfo> found = configObjectFinder.findDataObjectsByName(configuration, usedNames);
for (SecHubDataConfigurationObjectInfo info : found) {
if (info.getType() != SecHubDataConfigurationType.SOURCE) {
continue;
}
SecHubDataConfigurationObject config = info.getDataConfigurationObject();
if (!(config instanceof SecHubSourceDataConfiguration)) {
LOG.warn("source object data was not expected {} but {}", SecHubSourceDataConfiguration.class, config.getClass());
continue;
}
SecHubSourceDataConfiguration sourceDataConfig = (SecHubSourceDataConfiguration) config;
addFileSystemParts(paths, sourceDataConfig);
}
}
Aggregations