Search in sources :

Example 1 with UseCaseUserCreatesNewJob

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());
}
Also used : ScheduleSecHubJob(com.mercedesbenz.sechub.domain.schedule.job.ScheduleSecHubJob) SecHubJobTraceLogID(com.mercedesbenz.sechub.domain.schedule.job.SecHubJobTraceLogID) Validated(org.springframework.validation.annotation.Validated) UseCaseUserCreatesNewJob(com.mercedesbenz.sechub.sharedkernel.usecases.user.execute.UseCaseUserCreatesNewJob)

Aggregations

ScheduleSecHubJob (com.mercedesbenz.sechub.domain.schedule.job.ScheduleSecHubJob)1 SecHubJobTraceLogID (com.mercedesbenz.sechub.domain.schedule.job.SecHubJobTraceLogID)1 UseCaseUserCreatesNewJob (com.mercedesbenz.sechub.sharedkernel.usecases.user.execute.UseCaseUserCreatesNewJob)1 Validated (org.springframework.validation.annotation.Validated)1