use of com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions in project hub-alert by blackducksoftware.
the class VulnerabilityNotificationFilterCustomFunctionAction method createActionResponse.
@Override
public ActionResponse<LabelValueSelectOptions> createActionResponse(FieldModel fieldModel, HttpServletContentWrapper servletContentWrapper) {
Optional<FieldValueModel> fieldValueModel = fieldModel.getFieldValueModel(ProviderDescriptor.KEY_NOTIFICATION_TYPES);
Collection<String> selectedNotificationTypes = fieldValueModel.map(FieldValueModel::getValues).orElse(List.of());
List<LabelValueSelectOption> options = List.of();
if (isFilterableVulnerability(selectedNotificationTypes)) {
options = retrieveBlackDuckVulnerabilityOptions();
}
LabelValueSelectOptions optionList = new LabelValueSelectOptions(options);
return new ActionResponse<>(HttpStatus.OK, optionList);
}
use of com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions in project hub-alert by blackducksoftware.
the class ProviderConfigSelectCustomFunctionAction method createActionResponse.
@Override
public ActionResponse<LabelValueSelectOptions> createActionResponse(FieldModel fieldModel, HttpServletContentWrapper servletContentWrapper) {
String providerName = fieldModel.getDescriptorName();
Optional<DescriptorKey> descriptorKey = descriptorMap.getDescriptorKey(providerName);
List<LabelValueSelectOption> options = List.of();
if (descriptorKey.isPresent()) {
List<ConfigurationModel> configurationModels = configurationModelConfigurationAccessor.getConfigurationsByDescriptorKeyAndContext(descriptorKey.get(), ConfigContextEnum.GLOBAL);
options = configurationModels.stream().map(this::createNameToIdOption).flatMap(Optional::stream).collect(Collectors.toList());
}
LabelValueSelectOptions optionList = new LabelValueSelectOptions(options);
return new ActionResponse<>(HttpStatus.OK, optionList);
}
use of com.synopsys.integration.alert.common.descriptor.config.field.LabelValueSelectOptions in project hub-alert by blackducksoftware.
the class ProcessingSelectCustomFunctionAction method createActionResponse.
@Override
public ActionResponse<LabelValueSelectOptions> createActionResponse(FieldModel fieldModel, HttpServletContentWrapper servletContentWrapper) {
String channelName = fieldModel.getFieldValue(ChannelDescriptor.KEY_CHANNEL_NAME).orElse("");
List<LabelValueSelectOption> options = Arrays.stream(ProcessingType.values()).filter(processingType -> this.shouldInclude(processingType, channelName)).map(processingType -> new LabelValueSelectOption(processingType.getLabel(), processingType.name())).collect(Collectors.toList());
LabelValueSelectOptions optionList = new LabelValueSelectOptions(options);
return new ActionResponse<>(HttpStatus.OK, optionList);
}
Aggregations