Search in sources :

Example 6 with MappingIdentifier

use of com.mercedesbenz.sechub.sharedkernel.mapping.MappingIdentifier 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?");
    }
}
Also used : MappingIdentifier(com.mercedesbenz.sechub.sharedkernel.mapping.MappingIdentifier) ScanConfig(com.mercedesbenz.sechub.domain.scan.config.ScanConfig) DeveloperToolsScanConfigService(com.mercedesbenz.sechub.domain.scan.config.DeveloperToolsScanConfigService) NamePatternIdprovider(com.mercedesbenz.sechub.domain.scan.config.NamePatternIdprovider)

Aggregations

MappingIdentifier (com.mercedesbenz.sechub.sharedkernel.mapping.MappingIdentifier)6 DeveloperToolsScanConfigService (com.mercedesbenz.sechub.domain.scan.config.DeveloperToolsScanConfigService)1 DeveloperToolsScanMappingConfigurationService (com.mercedesbenz.sechub.domain.scan.config.DeveloperToolsScanMappingConfigurationService)1 NamePatternIdProvider (com.mercedesbenz.sechub.domain.scan.config.NamePatternIdProvider)1 NamePatternIdprovider (com.mercedesbenz.sechub.domain.scan.config.NamePatternIdprovider)1 ScanConfig (com.mercedesbenz.sechub.domain.scan.config.ScanConfig)1 ScanMappingConfiguration (com.mercedesbenz.sechub.domain.scan.config.ScanMappingConfiguration)1 MappingType (com.mercedesbenz.sechub.sharedkernel.mapping.MappingIdentifier.MappingType)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 Test (org.junit.Test)1