Search in sources :

Example 1 with ExistingIssuesInOctane

use of com.hp.octane.integrations.services.vulnerabilities.ExistingIssuesInOctane in project octane-ci-java-sdk by MicroFocus.

the class FODServiceImpl method fetchIssues.

private List<OctaneIssue> fetchIssues(VulnerabilitiesQueueItem queueItem, String remoteTag) throws IOException {
    logger.warn(configurer.octaneConfiguration.getLocationForLog() + "Security scan is done.");
    List<Vulnerability> allVulnerabilities = FODVulnerabilityService.getAllVulnerabilities(getRelease(queueItem));
    List<Vulnerability> nonClosedIssues = filterOutBeforeBaselineIssues(queueItem.getBaselineDate(), allVulnerabilities);
    ExistingIssuesInOctane existingIssuesInOctane = new ExistingIssuesInOctane(this.restService.obtainOctaneRestClient(), this.configurer.octaneConfiguration);
    List<String> existingIssuesInOc = existingIssuesInOctane.getRemoteIdsOpenVulnsFromOctane(queueItem.getJobId(), queueItem.getBuildId(), remoteTag);
    PackIssuesToOctaneUtils.SortedIssues<Vulnerability> sortedIssues = PackIssuesToOctaneUtils.packToOctaneIssues(nonClosedIssues, existingIssuesInOc, true);
    FODValuesConverter securityIssueValuesHelper = new FODValuesConverter();
    securityIssueValuesHelper.init();
    Map<String, VulnerabilityAllData> idToAllData = getVulnerabilityAllDataMap(getRelease(queueItem), sortedIssues.issuesRequiredExtendedData);
    logger.warn(configurer.octaneConfiguration.getLocationForLog() + "fetch existing issues from Octane");
    List<OctaneIssue> octaneIssuesToUpdate = securityIssueValuesHelper.createOctaneIssuesFromVulns(sortedIssues.issuesToUpdate, remoteTag, idToAllData, queueItem.getBaselineDate());
    List<OctaneIssue> total = new ArrayList<>();
    total.addAll(octaneIssuesToUpdate);
    logger.warn(configurer.octaneConfiguration.getLocationForLog() + "ToUpdate " + octaneIssuesToUpdate.size() + " items : " + octaneIssuesToUpdate);
    total.addAll(sortedIssues.issuesToClose);
    logger.warn(configurer.octaneConfiguration.getLocationForLog() + "ToClose " + sortedIssues.issuesToClose.size() + " items : " + sortedIssues.issuesToClose);
    return total;
}
Also used : ExistingIssuesInOctane(com.hp.octane.integrations.services.vulnerabilities.ExistingIssuesInOctane) Vulnerability(com.hp.octane.integrations.services.vulnerabilities.fod.dto.pojos.Vulnerability) OctaneIssue(com.hp.octane.integrations.dto.securityscans.OctaneIssue) PackIssuesToOctaneUtils(com.hp.octane.integrations.services.vulnerabilities.PackIssuesToOctaneUtils) VulnerabilityAllData(com.hp.octane.integrations.services.vulnerabilities.fod.dto.pojos.VulnerabilityAllData)

Aggregations

OctaneIssue (com.hp.octane.integrations.dto.securityscans.OctaneIssue)1 ExistingIssuesInOctane (com.hp.octane.integrations.services.vulnerabilities.ExistingIssuesInOctane)1 PackIssuesToOctaneUtils (com.hp.octane.integrations.services.vulnerabilities.PackIssuesToOctaneUtils)1 Vulnerability (com.hp.octane.integrations.services.vulnerabilities.fod.dto.pojos.Vulnerability)1 VulnerabilityAllData (com.hp.octane.integrations.services.vulnerabilities.fod.dto.pojos.VulnerabilityAllData)1