use of com.synopsys.integration.alert.api.channel.jira.distribution.search.JiraIssueAlertPropertiesUrlCorrector in project hub-alert by blackducksoftware.
the class JiraIssueCreator method createSearchProperties.
private JiraIssueSearchProperties createSearchProperties(ProjectIssueModel alertIssueSource) {
LinkableItem provider = alertIssueSource.getProvider();
LinkableItem project = alertIssueSource.getProject();
LinkableItem projectVersion = alertIssueSource.getProjectVersion().orElseThrow(() -> new AlertRuntimeException("Missing project version"));
IssueBomComponentDetails bomComponent = alertIssueSource.getBomComponentDetails();
LinkableItem component = bomComponent.getComponent();
String componentVersionLabel = bomComponent.getComponentVersion().map(LinkableItem::getLabel).orElse(null);
String componentVersionName = bomComponent.getComponentVersion().map(LinkableItem::getValue).orElse(null);
String additionalKey = null;
ComponentConcernType concernType = ComponentConcernType.VULNERABILITY;
Optional<String> optionalPolicyName = alertIssueSource.getPolicyDetails().map(IssuePolicyDetails::getName);
if (optionalPolicyName.isPresent()) {
concernType = ComponentConcernType.POLICY;
additionalKey = JiraIssueSearchPropertyStringCompatibilityUtils.createPolicyAdditionalKey(optionalPolicyName.get());
}
if (alertIssueSource.getComponentUnknownVersionDetails().isPresent()) {
concernType = ComponentConcernType.UNKNOWN_VERSION;
}
String category = JiraIssueSearchPropertyStringCompatibilityUtils.createCategory(concernType);
return new JiraIssueSearchProperties(provider.getLabel(), provider.getUrl().flatMap(JiraIssueAlertPropertiesUrlCorrector::correctUrl).orElse(null), project.getLabel(), project.getValue(), projectVersion.getLabel(), projectVersion.getValue(), category, component.getLabel(), component.getValue(), componentVersionLabel, componentVersionName, additionalKey);
}
Aggregations