Search in sources :

Example 1 with UseCaseAdminRestartsJobHard

use of com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard in project sechub by mercedes-benz.

the class JobRestartRequestService method restartJobHard.

@Validated
@UseCaseAdminRestartsJobHard(@Step(number = 2, name = "Restart job", description = "Will trigger event that job restart (hard) requested"))
public void restartJobHard(UUID jobUUID) {
    assertion.assertIsValidJobUUID(jobUUID);
    auditLogService.log("Requested restart (hard) of job {}", jobUUID);
    JobMessage message = buildMessage(jobUUID);
    /* trigger event */
    triggerJobHardRestartRequest(message);
}
Also used : JobMessage(com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage) Validated(org.springframework.validation.annotation.Validated) UseCaseAdminRestartsJobHard(com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard)

Example 2 with UseCaseAdminRestartsJobHard

use of com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard in project sechub by mercedes-benz.

the class InformAdminsThatJobRestartHasBeenTriggeredService method notify.

@UseCaseAdminRestartsJobHard(@Step(number = 4, name = "Inform sechub admins when job has been restarted"))
@UseCaseAdminRestartsJob(@Step(number = 4, name = "Inform sechub admins when job has been restarted"))
public void notify(JobMessage jobMessage, String baseUrl) {
    requireNonNull(jobMessage);
    SimpleMailMessage message = factory.createMessage("Restart of SecHub Job " + jobMessage.getJobUUID() + " triggered");
    message.setTo(notificationConfiguration.getEmailAdministrators());
    message.setText(createEmailContent(jobMessage, baseUrl));
    emailService.send(message);
}
Also used : SimpleMailMessage(org.springframework.mail.SimpleMailMessage) UseCaseAdminRestartsJobHard(com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard) UseCaseAdminRestartsJob(com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJob)

Example 3 with UseCaseAdminRestartsJobHard

use of com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard in project sechub by mercedes-benz.

the class InformAdminsThatJobRestartWasCanceledService method notify.

@UseCaseAdminRestartsJobHard(@Step(number = 3, name = "Inform sechub admins when job restart was canceled"))
@UseCaseAdminRestartsJob(@Step(number = 3, name = "Inform sechub admins when job restart was canceled"))
public void notify(JobMessage jobMessage, String baseUrl) {
    requireNonNull(jobMessage);
    SimpleMailMessage message = factory.createMessage("Restart of SecHub Job " + jobMessage.getJobUUID() + " was canceled");
    message.setTo(notificationConfiguration.getEmailAdministrators());
    message.setText(createEmailContent(jobMessage, baseUrl));
    emailService.send(message);
}
Also used : SimpleMailMessage(org.springframework.mail.SimpleMailMessage) UseCaseAdminRestartsJobHard(com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard) UseCaseAdminRestartsJob(com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJob)

Example 4 with UseCaseAdminRestartsJobHard

use of com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard in project sechub by mercedes-benz.

the class InformAdminsThatJobResultsHaveBeenPurgedService method notify.

@UseCaseAdminRestartsJobHard(@Step(number = 5, name = "Inform sechub admins when job results have been purged"))
@UseCaseAdminRestartsJob(@Step(number = 5, name = "Inform sechub admins when job results have been purged"))
public void notify(UUID sechubJobUUID, String baseUrl) {
    requireNonNull(sechubJobUUID);
    SimpleMailMessage message = factory.createMessage("Results of SecHub Job " + sechubJobUUID + " have been purged");
    message.setTo(notificationConfiguration.getEmailAdministrators());
    message.setText(createEmailContent(sechubJobUUID, baseUrl));
    emailService.send(message);
}
Also used : SimpleMailMessage(org.springframework.mail.SimpleMailMessage) UseCaseAdminRestartsJobHard(com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard) UseCaseAdminRestartsJob(com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJob)

Aggregations

UseCaseAdminRestartsJobHard (com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJobHard)4 UseCaseAdminRestartsJob (com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJob)3 SimpleMailMessage (org.springframework.mail.SimpleMailMessage)3 JobMessage (com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage)1 Validated (org.springframework.validation.annotation.Validated)1