Search in sources :

Example 1 with BdioCodeLocationResult

use of com.blackducksoftware.integration.hub.detect.workflow.codelocation.BdioCodeLocationResult in project hub-detect by blackducksoftware.

the class BdioManager method createBdioFiles.

public BdioResult createBdioFiles(String aggregateName, NameVersion projectNameVersion, List<DetectCodeLocation> codeLocations) throws DetectUserFriendlyException {
    DetectBdioWriter detectBdioWriter = new DetectBdioWriter(simpleBdioFactory, detectInfo);
    if (StringUtils.isBlank(aggregateName)) {
        logger.info("Creating BDIO code locations.");
        final BdioCodeLocationResult codeLocationResult = bdioCodeLocationCreator.createFromDetectCodeLocations(codeLocations, projectNameVersion);
        codeLocationResult.getFailedBomToolGroupTypes().forEach(it -> eventSystem.publishEvent(Event.StatusSummary, new DetectorStatus(it, StatusType.FAILURE)));
        logger.info("Creating BDIO files from code locations.");
        CodeLocationBdioCreator codeLocationBdioCreator = new CodeLocationBdioCreator(detectBdioWriter, simpleBdioFactory);
        final List<UploadTarget> uploadTargets = codeLocationBdioCreator.createBdioFiles(directoryManager.getBdioOutputDirectory(), codeLocationResult.getBdioCodeLocations(), projectNameVersion);
        return new BdioResult(uploadTargets);
    } else {
        logger.info("Creating aggregate BDIO file.");
        AggregateBdioCreator aggregateBdioCreator = new AggregateBdioCreator(simpleBdioFactory, integrationEscapeUtil, codeLocationNameManager, detectConfiguration, detectBdioWriter);
        final Optional<UploadTarget> uploadTarget = aggregateBdioCreator.createAggregateBdioFile(directoryManager.getSourceDirectory(), directoryManager.getBdioOutputDirectory(), codeLocations, projectNameVersion);
        if (uploadTarget.isPresent()) {
            return new BdioResult(Arrays.asList(uploadTarget.get()));
        } else {
            return new BdioResult(Collections.emptyList());
        }
    }
}
Also used : DetectorStatus(com.blackducksoftware.integration.hub.detect.workflow.status.DetectorStatus) UploadTarget(com.synopsys.integration.blackduck.codelocation.bdioupload.UploadTarget) BdioCodeLocationResult(com.blackducksoftware.integration.hub.detect.workflow.codelocation.BdioCodeLocationResult)

Aggregations

BdioCodeLocationResult (com.blackducksoftware.integration.hub.detect.workflow.codelocation.BdioCodeLocationResult)1 DetectorStatus (com.blackducksoftware.integration.hub.detect.workflow.status.DetectorStatus)1 UploadTarget (com.synopsys.integration.blackduck.codelocation.bdioupload.UploadTarget)1