use of com.synopsys.integration.blackduck.codelocation.bdioupload.UploadOutput in project hub-detect by blackducksoftware.
the class DetectBdioUploadService method uploadBdioFiles.
public CodeLocationCreationData<UploadBatchOutput> uploadBdioFiles(List<UploadTarget> uploadTargets) throws IntegrationException, DetectUserFriendlyException {
UploadBatch uploadBatch = new UploadBatch();
for (UploadTarget uploadTarget : uploadTargets) {
logger.info(String.format("uploading %s to %s", uploadTarget.getUploadFile().getName(), detectConfiguration.getProperty(DetectProperty.BLACKDUCK_URL, PropertyAuthority.None)));
uploadBatch.addUploadTarget(uploadTarget);
}
BdioUploadCodeLocationCreationRequest uploadRequest = bdioUploadService.createUploadRequest(uploadBatch);
CodeLocationCreationData<UploadBatchOutput> response = bdioUploadService.uploadBdio(uploadRequest);
for (UploadOutput uploadOutput : response.getOutput()) {
if (uploadOutput.getResult() == Result.FAILURE) {
logger.error("Failed to upload code location: " + uploadOutput.getCodeLocationName());
logger.error("Reason: " + uploadOutput.getErrorMessage().orElse("Unknown reason."));
throw new DetectUserFriendlyException("An error occurred uploading a bdio file.", uploadOutput.getException().orElse(null), ExitCodeType.FAILURE_BLACKDUCK_FEATURE_ERROR);
}
}
return response;
}
Aggregations