use of com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage in project sechub by mercedes-benz.
the class JobRestartRequestService method buildMessage.
private JobMessage buildMessage(UUID jobUUID) {
JobMessage message = new JobMessage();
message.setJobUUID(jobUUID);
JobInformation probe = new JobInformation();
probe.setJobUUID(jobUUID);
Example<JobInformation> example = Example.of(probe);
Optional<JobInformation> optJobInfo = repository.findOne(example);
if (!optJobInfo.isPresent()) {
LOG.warn("Did not found job information, so not able to resolve owner email address");
return message;
}
JobInformation jobInfo = optJobInfo.get();
if (jobInfo.owner == null) {
LOG.warn("Did not found owner inside job information, so not able to resolve owner email address");
return message;
}
Optional<User> optUser = userRepository.findById(jobInfo.owner);
if (!optUser.isPresent()) {
LOG.warn("Did not found owner {} inside user repo, so not able to resolve owner email address", jobInfo.owner);
return message;
}
message.setOwner(jobInfo.owner);
message.setOwnerEmailAddress(optUser.get().getEmailAdress());
return message;
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage 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);
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage in project sechub by mercedes-benz.
the class JobAdministrationMessageHandler method handleJobFailed.
@IsReceivingAsyncMessage(MessageID.JOB_FAILED)
private void handleJobFailed(DomainMessage request) {
JobMessage message = request.get(MessageDataKeys.JOB_FAILED_DATA);
deleteService.delete(message.getJobUUID());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage in project sechub by mercedes-benz.
the class JobAdministrationMessageHandler method handleJobDone.
@IsReceivingAsyncMessage(MessageID.JOB_DONE)
private void handleJobDone(DomainMessage request) {
JobMessage message = request.get(MessageDataKeys.JOB_DONE_DATA);
deleteService.delete(message.getJobUUID());
}
use of com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage in project sechub by mercedes-benz.
the class JobAdministrationMessageHandler method handleJobCanceled.
@IsReceivingAsyncMessage(MessageID.JOB_CANCELED)
private void handleJobCanceled(DomainMessage request) {
JobMessage message = request.get(MessageDataKeys.JOB_CANCEL_DATA);
// we do drop job info - we only hold running and waiting jobs!
deleteService.delete(message.getJobUUID());
}
Aggregations