use of com.synopsys.integration.alert.common.persistence.model.job.details.processor.DistributionJobDetailsExtractor in project hub-alert by blackducksoftware.
the class DistributionJobModelExtractor method convertToJobModel.
public final DistributionJobModel convertToJobModel(UUID jobId, Map<String, ConfigurationFieldModel> configuredFieldsMap, OffsetDateTime createdAt, @Nullable OffsetDateTime lastUpdated, List<BlackDuckProjectDetailsModel> projectFilterDetails) {
String channelDescriptorName = distributionJobFieldExtractor.extractFieldValueOrEmptyString(ChannelDescriptor.KEY_CHANNEL_NAME, configuredFieldsMap);
DistributionJobModelBuilder builder = DistributionJobModel.builder().jobId(jobId).enabled(distributionJobFieldExtractor.extractFieldValue(ChannelDescriptor.KEY_ENABLED, configuredFieldsMap).map(Boolean::valueOf).orElse(true)).name(distributionJobFieldExtractor.extractFieldValueOrEmptyString(ChannelDescriptor.KEY_NAME, configuredFieldsMap)).distributionFrequency(distributionJobFieldExtractor.extractFieldValueOrEmptyString(ChannelDescriptor.KEY_FREQUENCY, configuredFieldsMap)).processingType(distributionJobFieldExtractor.extractFieldValueOrEmptyString(ProviderDescriptor.KEY_PROCESSING_TYPE, configuredFieldsMap)).channelDescriptorName(channelDescriptorName).channelGlobalConfigId(distributionJobFieldExtractor.extractFieldValue(ChannelDescriptor.KEY_CHANNEL_GLOBAL_CONFIG_ID, configuredFieldsMap).map(UUID::fromString).orElse(null)).createdAt(createdAt).lastUpdated(lastUpdated).blackDuckGlobalConfigId(distributionJobFieldExtractor.extractFieldValue(ProviderDescriptor.KEY_COMMON_CONFIG_ID, configuredFieldsMap).map(Long::valueOf).orElse(-1L)).filterByProject(distributionJobFieldExtractor.extractFieldValue(ProviderDescriptor.KEY_FILTER_BY_PROJECT, configuredFieldsMap).map(Boolean::valueOf).orElse(false)).projectNamePattern(distributionJobFieldExtractor.extractFieldValue(ProviderDescriptor.KEY_PROJECT_NAME_PATTERN, configuredFieldsMap).orElse(null)).projectVersionNamePattern(distributionJobFieldExtractor.extractFieldValue(ProviderDescriptor.KEY_PROJECT_VERSION_NAME_PATTERN, configuredFieldsMap).orElse(null)).notificationTypes(distributionJobFieldExtractor.extractFieldValues(ProviderDescriptor.KEY_NOTIFICATION_TYPES, configuredFieldsMap)).policyFilterPolicyNames(distributionJobFieldExtractor.extractFieldValues("blackduck.policy.notification.filter", configuredFieldsMap)).vulnerabilityFilterSeverityNames(distributionJobFieldExtractor.extractFieldValues("blackduck.vulnerability.notification.filter", configuredFieldsMap)).projectFilterDetails(projectFilterDetails);
DistributionJobDetailsExtractor extractor = jobDetailsExtractorMap.findRequiredAction(channelDescriptorName);
DistributionJobDetailsModel distributionJobDetailsModel = extractor.extractDetails(jobId, configuredFieldsMap);
builder.distributionJobDetails(distributionJobDetailsModel);
return builder.build();
}
Aggregations