Search in sources :

Example 61 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class JobRestartRequestService method triggerJobRestartRequest.

@IsSendingAsyncMessage(MessageID.REQUEST_JOB_RESTART)
private void triggerJobRestartRequest(JobMessage message) {
    DomainMessage infoRequest = DomainMessageFactory.createEmptyRequest(MessageID.REQUEST_JOB_RESTART);
    infoRequest.set(MessageDataKeys.JOB_RESTART_DATA, message);
    infoRequest.set(MessageDataKeys.ENVIRONMENT_BASE_URL, sechubEnvironment.getServerBaseUrl());
    eventBusService.sendAsynchron(infoRequest);
}
Also used : DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 62 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class ProjectUnassignUserService method sendUserRemovedFromProjectEvent.

@IsSendingAsyncMessage(MessageID.USER_REMOVED_FROM_PROJECT)
private void sendUserRemovedFromProjectEvent(String projectId, User user) {
    DomainMessage request = new DomainMessage(MessageID.USER_REMOVED_FROM_PROJECT);
    UserMessage projectToUserData = new UserMessage();
    projectToUserData.setUserId(user.getName());
    projectToUserData.setProjectIds(Arrays.asList(projectId));
    request.set(MessageDataKeys.PROJECT_TO_USER_DATA, projectToUserData);
    eventBus.sendAsynchron(request);
}
Also used : UserMessage(com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 63 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class AnonymousUserRequestsNewApiTokenService method sendUserNewApiTokenRequested.

@IsSendingAsyncMessage(MessageID.USER_NEW_API_TOKEN_REQUESTED)
private void sendUserNewApiTokenRequested(String userEmail, User user) {
    /* we just send info about new api token */
    DomainMessage infoRequest = new DomainMessage(MessageID.USER_NEW_API_TOKEN_REQUESTED);
    UserMessage userMessage = new UserMessage();
    userMessage.setEmailAdress(userEmail);
    /*
         * Security: we do NOT use userid inside this link - if some body got
         * information about the link he/she is not able to use fetched api token
         * because not knowing which userid...
         */
    String linkWithOneTimeToken = environment.getServerBaseUrl() + AdministrationAPIConstants.API_FETCH_NEW_API_TOKEN_BY_ONE_WAY_TOKEN + "/" + user.getOneTimeToken();
    userMessage.setLinkWithOneTimeToken(linkWithOneTimeToken);
    userMessage.setSubject("Your request for a new SecHub API token");
    infoRequest.set(MessageDataKeys.USER_ONE_TIME_TOKEN_INFO, userMessage);
    eventBusService.sendAsynchron(infoRequest);
}
Also used : UserMessage(com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 64 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class JobRestartRequestService method triggerJobHardRestartRequest.

@IsSendingAsyncMessage(MessageID.REQUEST_JOB_RESTART_HARD)
private void triggerJobHardRestartRequest(JobMessage message) {
    DomainMessage infoRequest = DomainMessageFactory.createEmptyRequest(MessageID.REQUEST_JOB_RESTART_HARD);
    infoRequest.set(MessageDataKeys.JOB_RESTART_DATA, message);
    infoRequest.set(MessageDataKeys.ENVIRONMENT_BASE_URL, sechubEnvironment.getServerBaseUrl());
    eventBusService.sendAsynchron(infoRequest);
}
Also used : DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 65 with DomainMessage

use of com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage in project sechub by mercedes-benz.

the class UpdateMappingService method sendEvent.

@IsSendingAsyncMessage(MessageID.MAPPING_CONFIGURATION_CHANGED)
private void sendEvent(Mapping mapping) {
    MappingMessage mappingMessage = new MappingMessage();
    mappingMessage.setMappingId(mapping.getId());
    mappingMessage.setMappingData(MappingData.fromString(mapping.getData()));
    DomainMessage request = DomainMessageFactory.createEmptyRequest(MessageID.MAPPING_CONFIGURATION_CHANGED);
    request.set(MessageDataKeys.CONFIG_MAPPING_DATA, mappingMessage);
    eventBus.sendAsynchron(request);
}
Also used : MappingMessage(com.mercedesbenz.sechub.sharedkernel.messaging.MappingMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Aggregations

DomainMessage (com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage)69 IsSendingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)31 UserMessage (com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage)21 Test (org.junit.Test)18 Test (org.junit.jupiter.api.Test)13 ProjectMessage (com.mercedesbenz.sechub.sharedkernel.messaging.ProjectMessage)10 DomainMessageSynchronousResult (com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessageSynchronousResult)8 JobMessage (com.mercedesbenz.sechub.sharedkernel.messaging.JobMessage)6 AdministrationConfigMessage (com.mercedesbenz.sechub.sharedkernel.messaging.AdministrationConfigMessage)5 BatchJobMessage (com.mercedesbenz.sechub.sharedkernel.messaging.BatchJobMessage)4 SecHubConfiguration (com.mercedesbenz.sechub.sharedkernel.configuration.SecHubConfiguration)3 IsSendingSyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingSyncMessage)3 UUID (java.util.UUID)3 ScheduleSecHubJob (com.mercedesbenz.sechub.domain.schedule.job.ScheduleSecHubJob)2 SecHubExecutionException (com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionException)2 SecHubRuntimeException (com.mercedesbenz.sechub.commons.model.SecHubRuntimeException)1 AdministrationAutoCleanupConfig (com.mercedesbenz.sechub.domain.administration.autocleanup.AdministrationAutoCleanupConfig)1 User (com.mercedesbenz.sechub.domain.administration.user.User)1 ScanMockData (com.mercedesbenz.sechub.domain.scan.project.ScanMockData)1 ScanProjectConfig (com.mercedesbenz.sechub.domain.scan.project.ScanProjectConfig)1