use of com.synopsys.integration.alert.api.channel.issue.model.IssueVulnerabilityModel in project hub-alert by blackducksoftware.
the class ProjectMessageToIssueModelTransformer method createVulnerabilityProjectIssueModel.
private ProjectIssueModel createVulnerabilityProjectIssueModel(ProjectMessage projectMessage, IssueBomComponentDetails issueBomComponent, List<ComponentConcern> vulnerabilityConcerns) {
List<IssueVulnerabilityModel> issueVulnerabilitiesAdded = new LinkedList<>();
List<IssueVulnerabilityModel> issueVulnerabilitiesUpdated = new LinkedList<>();
List<IssueVulnerabilityModel> issueVulnerabilitiesDeleted = new LinkedList<>();
for (ComponentConcern vulnerabilityConcern : vulnerabilityConcerns) {
IssueVulnerabilityModel issueVulnerabilityModel = IssueVulnerabilityModel.fromComponentConcern(vulnerabilityConcern);
ItemOperation vulnOperation = vulnerabilityConcern.getOperation();
if (ItemOperation.ADD.equals(vulnOperation)) {
issueVulnerabilitiesAdded.add(issueVulnerabilityModel);
} else if (ItemOperation.DELETE.equals(vulnOperation)) {
issueVulnerabilitiesDeleted.add(issueVulnerabilityModel);
} else {
issueVulnerabilitiesUpdated.add(issueVulnerabilityModel);
}
}
ComponentVulnerabilities componentVulnerabilities = issueBomComponent.getComponentVulnerabilities();
IssueVulnerabilityDetails vulnerabilityDetails = new IssueVulnerabilityDetails(!componentVulnerabilities.hasVulnerabilities(), issueVulnerabilitiesAdded, issueVulnerabilitiesUpdated, issueVulnerabilitiesDeleted);
return ProjectIssueModel.vulnerability(projectMessage.getProviderDetails(), projectMessage.getProject(), projectMessage.getProjectVersion().orElse(null), issueBomComponent, vulnerabilityDetails);
}
Aggregations