use of com.hp.octane.integrations.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class SonarToOctaneIssueUtil method createOctaneIssues.
public static List<OctaneIssue> createOctaneIssues(List<SonarIssue> issues, String remoteTag, String sonarUrl, Set<String> issuesRequiredExtendedDataKeys, Map<String, SonarRule> rules) {
if (issues == null) {
return new ArrayList<>();
}
DTOFactory dtoFactory = DTOFactory.getInstance();
List<OctaneIssue> octaneIssues = new ArrayList<>();
for (SonarIssue issue : issues) {
OctaneIssue octaneIssue = createOctaneIssue(dtoFactory, issue, rules, sonarUrl);
octaneIssue.setRemoteTag(remoteTag);
octaneIssues.add(octaneIssue);
if (issuesRequiredExtendedDataKeys.contains(issue.getKey())) {
Map<String, String> extendedData = prepareExtendedData(issue, rules);
octaneIssue.setExtendedData(extendedData);
setOctaneStatus(issue, octaneIssue, true);
} else {
setOctaneStatus(issue, octaneIssue, false);
}
}
return octaneIssues;
}
use of com.hp.octane.integrations.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class SSCServiceImpl method getVulnerabilitiesScanResultStream.
@Override
public InputStream getVulnerabilitiesScanResultStream(VulnerabilitiesQueueItem queueItem) {
try {
String targetDir = getTargetDir(getConfigurer().pluginServices.getAllowedOctaneStorage(), queueItem.getJobId(), queueItem.getBuildId());
logger.debug(configurer.octaneConfiguration.getLocationForLog() + "targetDir:" + targetDir);
InputStream cachedScanResult = getCachedScanResult(targetDir);
if (cachedScanResult != null) {
logger.warn(configurer.octaneConfiguration.getLocationForLog() + "Results are cached.");
return cachedScanResult;
}
List<OctaneIssue> octaneIssues = getNonCacheVulnerabilitiesScanResultStream(queueItem);
logger.debug(configurer.octaneConfiguration.getLocationForLog() + "Done retrieving non-cached.");
if (octaneIssues == null) {
return null;
}
cacheIssues(targetDir, octaneIssues);
return IssuesFileSerializer.serializeIssues(octaneIssues);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.hp.octane.integrations.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class FODValuesConverter method createIssue.
private OctaneIssue createIssue(Vulnerability vulnerability, String remoteTag, VulnerabilityAllData vulnerabilityAllData, Date baselineDate) {
OctaneIssue entity = new OctaneIssueImpl();
entity.setCategory(vulnerability.category);
if (vulnerability.introducedDate != null) {
String dateAsString = getIntroducedDate(vulnerability.introducedDate, baselineDate);
entity.setIntroducedDate(dateAsString);
}
setAdditionalData(vulnerability, entity, vulnerabilityAllData);
entity.setLine(vulnerability.lineNumber);
entity.setToolName(FODConstants.FODTool);
entity.setPackage(vulnerability.packageValue);
// entity.setPRid(vulnerability.);
entity.setPrimaryLocationFull(vulnerability.primaryLocationFull);
setStatus(entity, vulnerability.status);
setSeverity(entity, vulnerability.severity);
entity.setRemoteId(vulnerability.getRemoteId());
if (vulnerabilityAllData != null) {
setExternalLink(vulnerability, entity);
}
setAssignedUser(entity, vulnerability.assignedUser);
setAnalysis(entity, vulnerability);
entity.setRemoteTag(remoteTag);
// setToolType(entity);
return entity;
}
use of com.hp.octane.integrations.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class SSCToOctaneIssueUtil method createOctaneIssue.
private static OctaneIssue createOctaneIssue(DTOFactory dtoFactory, Issues.Issue issue, IssueDetails issueDetails) {
logger.debug("enter createOctaneIssue");
OctaneIssue octaneIssue = dtoFactory.newDTO(OctaneIssue.class);
setOctaneAnalysis(dtoFactory, issue, octaneIssue);
setOctaneSeverity(dtoFactory, issue, octaneIssue);
setOctaneStatus(issue, octaneIssue);
Map<String, String> extendedData = prepareExtendedData(issue, issueDetails);
octaneIssue.setExtendedData(extendedData);
octaneIssue.setPrimaryLocationFull(issue.fullFileName);
octaneIssue.setLine(issue.lineNumber);
octaneIssue.setRemoteId(issue.issueInstanceId);
octaneIssue.setIntroducedDate(convertDates(issue.foundDate));
octaneIssue.setExternalLink(issue.hRef);
octaneIssue.setToolName(EXTERNAL_TOOL_NAME);
octaneIssue.setCategory(issue.issueName);
octaneIssue.setPackage(issue.package1);
logger.debug("exit createOctaneIssue");
return octaneIssue;
}
use of com.hp.octane.integrations.dto.securityscans.OctaneIssue in project octane-ci-java-sdk by MicroFocus.
the class SSCToOctaneIssueUtil method createOctaneIssues.
public static List<OctaneIssue> createOctaneIssues(List<Issues.Issue> issues, String remoteTag, Map<Integer, IssueDetails> issueDetailsById) {
if (issues == null) {
return new ArrayList<>();
}
logger.warn("SSCToOctane.createOctaneIssues");
DTOFactory dtoFactory = DTOFactory.getInstance();
List<OctaneIssue> octaneIssues = new ArrayList<>();
for (Issues.Issue issue : issues) {
OctaneIssue octaneIssue = createOctaneIssue(dtoFactory, issue, issueDetailsById.get(issue.id));
octaneIssues.add(octaneIssue);
octaneIssue.setRemoteTag(remoteTag);
}
return octaneIssues;
}
Aggregations