use of com.mercedesbenz.sechub.domain.scan.config.ScanConfig in project sechub by mercedes-benz.
the class ScanConfigTestJSONasNamePatternDialogAction method createScanConfig.
private ScanConfig createScanConfig(String json, MappingIdentifier identifier) {
MappingData mappingData = MappingData.fromString(json);
ScanMapping mapping = new ScanMapping(identifier.getId());
mapping.setData(mappingData.toJSON());
ScanConfig config = new ScanMappingToScanConfigTransformer().transform(Collections.singletonList(mapping));
return config;
}
use of com.mercedesbenz.sechub.domain.scan.config.ScanConfig in project sechub by mercedes-benz.
the class ScanConfigTestJSONasNamePatternDialogAction method execute.
@Override
protected void execute(ActionEvent e) throws Exception {
/* convert to rows */
String json = getMappingUI().getJSON();
MappingIdentifier identifier = resolveMappingIdentifier();
ScanConfig config = createScanConfig(json, identifier);
DeveloperToolsScanConfigService scanConfigService = new DeveloperToolsScanConfigService();
scanConfigService.switchConfigurationIfChanged(config);
NamePatternIdprovider provider = scanConfigService.getNamePatternIdProvider(identifier);
boolean ongoing = true;
while (ongoing) {
/* ui */
Optional<String> value = getDialogUI().getContext().getDialogUI().getUserInput("Enter a name to check", "pattern");
if (!value.isPresent()) {
return;
}
String pattern = value.get();
String id = provider.getIdForName(pattern);
ongoing = getDialogUI().getContext().getDialogUI().confirm("Pattern '" + pattern + "' results in '" + id + "'\n\nDo you want to test another value?");
}
}
Aggregations