Search in sources :

Example 1 with UseCaseAdminRestartsJob

use of com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJob 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 2 with UseCaseAdminRestartsJob

use of com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJob 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 3 with UseCaseAdminRestartsJob

use of com.mercedesbenz.sechub.sharedkernel.usecases.job.UseCaseAdminRestartsJob 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)

Example 4 with UseCaseAdminRestartsJob

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

the class JobRestartRequestService method restartJob.

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

Aggregations

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