use of com.blackducksoftware.integration.hub.api.generated.view.CodeLocationView in project hub-detect by blackducksoftware.
the class HubManager method waitForBomUpdate.
public void waitForBomUpdate(final HubService hubService, final ScanStatusService scanStatusService, final ProjectVersionView version) throws IntegrationException, InterruptedException {
final List<CodeLocationView> allCodeLocations = hubService.getAllResponses(version, ProjectVersionView.CODELOCATIONS_LINK_RESPONSE);
final List<ScanSummaryView> scanSummaryViews = new ArrayList<>();
for (final CodeLocationView codeLocationView : allCodeLocations) {
final String scansLink = hubService.getFirstLinkSafely(codeLocationView, CodeLocationView.SCANS_LINK);
if (StringUtils.isNotBlank(scansLink)) {
final List<ScanSummaryView> codeLocationScanSummaryViews = hubService.getResponses(scansLink, ScanSummaryView.class, true);
scanSummaryViews.addAll(codeLocationScanSummaryViews);
}
}
logger.info("Waiting for the BOM to be updated");
scanStatusService.assertScansFinished(scanSummaryViews);
logger.info("The BOM has been updated");
}
use of com.blackducksoftware.integration.hub.api.generated.view.CodeLocationView in project hub-detect by blackducksoftware.
the class HubManager method manageExistingCodeLocations.
public void manageExistingCodeLocations(final List<String> codeLocationNames) {
if (!detectConfiguration.getHubOfflineMode()) {
final CodeLocationService codeLocationService = hubServiceWrapper.createCodeLocationService();
for (final String codeLocationName : codeLocationNames) {
try {
final CodeLocationView codeLocationView = codeLocationService.getCodeLocationByName(codeLocationName);
if (detectConfiguration.getProjectCodeLocationDeleteOldNames()) {
try {
codeLocationService.deleteCodeLocation(codeLocationView);
logger.info(String.format("Deleted code location '%s'", codeLocationName));
} catch (final IntegrationException e) {
logger.error(String.format("Not able to delete the code location '%s': %s", codeLocationName, e.getMessage()));
}
} else {
logger.warn(String.format("Found a code location with a naming pattern that is no longer supported: %s. This code location may need to be removed to avoid duplicate entries in the Bill of Materials. You can run with --detect.project.codelocation.delete.old.names=true which will automatically delete these code locations, but please USE CAUTION.", codeLocationName));
}
} catch (final DoesNotExistException e) {
logger.debug(String.format("Didn't find the code location %s - this is a good thing!", codeLocationName));
} catch (final IntegrationException e) {
logger.error(String.format("Error finding the code location name %s: %s", codeLocationName, e.getMessage()));
}
}
}
}
Aggregations