use of com.mercedesbenz.sechub.sharedkernel.usecases.user.execute.UseCaseUserCreatesNewJob in project sechub by mercedes-benz.
the class SchedulerCreateJobService method createJob.
@Validated
@UseCaseUserCreatesNewJob(@Step(number = 2, name = "Persistence and result", description = "Persist a new job entry and return Job UUID"))
public SchedulerResult createJob(String projectId, @Valid SecHubConfiguration configuration) {
assertion.assertIsValidProjectId(projectId);
/* we set the project id into configuration done by used url! */
configuration.setProjectId(projectId);
assertService.assertUserHasAccessToProject(projectId);
assertService.assertProjectAllowsWriteAccess(projectId);
assertService.assertExecutionAllowed(configuration);
ScheduleSecHubJob secHubJob = secHubJobFactory.createJob(configuration);
jobRepository.save(secHubJob);
SecHubJobTraceLogID traceLogId = traceLogID(secHubJob);
LOG.info("New job added:{}", traceLogId);
return new SchedulerResult(secHubJob.getUUID());
}
Aggregations