use of com.mercedesbenz.sechub.sharedkernel.error.NotFoundException in project sechub by mercedes-benz.
the class IntegrationTestSchedulerService method revertJobAsStillNotApproved.
public void revertJobAsStillNotApproved(UUID sechubJobUUID) {
Optional<ScheduleSecHubJob> found = repository.findById(sechubJobUUID);
if (!found.isPresent()) {
throw new NotFoundException("Job not found!");
}
ScheduleSecHubJob job = found.get();
job.setExecutionResult(ExecutionResult.NONE);
job.setExecutionState(ExecutionState.INITIALIZING);
job.setEnded(null);
job.setTrafficLight(null);
repository.save(job);
}
use of com.mercedesbenz.sechub.sharedkernel.error.NotFoundException in project sechub by mercedes-benz.
the class FullScanDataRestController method getFullScanZipFileForJob.
/* @formatter:off */
@UseCaseAdminDownloadsFullScanDataForJob(@Step(number = 1, next = 2, name = "REST API call to zip file containing full scan data", needsRestDoc = true))
@RequestMapping(path = "/scan/download/{sechubJobUUID}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE })
public void getFullScanZipFileForJob(@PathVariable("sechubJobUUID") UUID sechubJobUUID, HttpServletResponse response) {
/* @formatter:on */
auditLogService.log("Starts downloading full scan logs for sechub job {}", logSanitizer.sanitize(sechubJobUUID, -1));
response.setContentType("application/zip");
response.setHeader("Content-Disposition", "attachment; filename=full_scandata_" + sechubJobUUID.toString() + ".zip");
FullScanData fullScanData = fullScanDataService.getFullScanData(sechubJobUUID);
try (OutputStream outputStream = response.getOutputStream()) {
FullScanDataToZipOutputSupport support = new FullScanDataToZipOutputSupport();
support.writeScanData(fullScanData, outputStream);
} catch (IOException e) {
LOG.error("Was not able to provide zip file for full scan data of {}", logSanitizer.sanitize(sechubJobUUID, -1), e);
throw new NotFoundException("Was not able to support zip file, see logs for details");
}
}
Aggregations