use of com.blackducksoftware.integration.hub.detect.workflow.extraction.ExtractionResult in project hub-detect by blackducksoftware.
the class DetectorManager method runDetectors.
public DetectorToolResult runDetectors() throws DetectUserFriendlyException {
List<DetectorEvaluation> detectorEvaluations = new ArrayList<>();
// search
SearchResult searchResult = searchManager.performSearch();
eventSystem.publishEvent(Event.SearchCompleted, searchResult);
detectorEvaluations.addAll(searchResult.getDetectorEvaluations());
// prepare
PreparationResult preparationResult = preparationManager.prepareExtractions(detectorEvaluations);
eventSystem.publishEvent(Event.PreparationsCompleted, preparationResult);
// extract
ExtractionResult extractionResult = extractionManager.performExtractions(detectorEvaluations);
eventSystem.publishEvent(Event.ExtractionsCompleted, extractionResult);
// create results
DetectorToolResult detectorToolResult = new DetectorToolResult();
detectorToolResult.evaluatedDetectors = detectorEvaluations;
detectorToolResult.bomToolCodeLocations = extractionResult.getDetectCodeLocations();
detectorToolResult.applicableDetectorTypes = searchResult.getApplicableBomTools();
detectorToolResult.failedDetectorTypes.addAll(preparationResult.getFailedBomToolTypes());
detectorToolResult.failedDetectorTypes.addAll(extractionResult.getFailedBomToolTypes());
detectorToolResult.succesfullDetectorTypes.addAll(preparationResult.getSuccessfulBomToolTypes());
detectorToolResult.succesfullDetectorTypes.addAll(extractionResult.getSuccessfulBomToolTypes());
detectorToolResult.succesfullDetectorTypes.removeIf(it -> detectorToolResult.failedDetectorTypes.contains(it));
// post status
Map<DetectorType, StatusType> detectorStatus = new HashMap<>();
detectorToolResult.succesfullDetectorTypes.forEach(it -> detectorStatus.put(it, StatusType.SUCCESS));
detectorToolResult.failedDetectorTypes.forEach(it -> detectorStatus.put(it, StatusType.FAILURE));
detectorStatus.forEach((detector, status) -> eventSystem.publishEvent(Event.StatusSummary, new DetectorStatus(detector, status)));
return detectorToolResult;
}
Aggregations