use of com.synopsys.integration.alert.api.channel.jira.JiraIssueSearchProperties 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);
}
use of com.synopsys.integration.alert.api.channel.jira.JiraIssueSearchProperties in project hub-alert by blackducksoftware.
the class JiraIssueCreator method assignAlertSearchProperties.
@Override
protected final void assignAlertSearchProperties(ExistingIssueDetails<String> createdIssueDetails, ProjectIssueModel alertIssueSource) throws AlertException {
JiraIssueSearchProperties searchProperties = createSearchProperties(alertIssueSource);
issuePropertiesManager.assignIssueProperties(createdIssueDetails.getIssueKey(), searchProperties);
}
use of com.synopsys.integration.alert.api.channel.jira.JiraIssueSearchProperties in project hub-alert by blackducksoftware.
the class JiraIssueSearchResultCreator method createResultFromProjectIssue.
public ProjectIssueSearchResult<String> createResultFromProjectIssue(JiraSearcherResponseModel issue, ProviderDetails providerDetails, LinkableItem project) throws AlertException {
JiraIssueSearchProperties issueProperties = issuePropertiesManager.retrieveIssueProperties(issue.getIssueKey());
String nullableSubComponentName = issueProperties.getSubComponentName();
String nullableSubComponentValue = issueProperties.getSubComponentValue();
LinkableItem componentVersion = null;
if (StringUtils.isNotBlank(nullableSubComponentName) && StringUtils.isNotBlank(nullableSubComponentValue)) {
componentVersion = new LinkableItem(nullableSubComponentName, nullableSubComponentValue);
}
LinkableItem projectVersion = new LinkableItem(issueProperties.getSubTopicName(), issueProperties.getSubTopicValue());
IssueBomComponentDetails bomComponentDetails = IssueBomComponentDetails.fromSearchResults(new LinkableItem(issueProperties.getComponentName(), issueProperties.getComponentValue()), componentVersion);
ProjectIssueModel projectIssueModel = ProjectIssueModel.bom(providerDetails, project, projectVersion, bomComponentDetails);
return createIssueResult(issue, projectIssueModel);
}
Aggregations