Search in sources :

Example 1 with UserMessage

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

the class ProjectAssignUserService method sendUserAddedToProjectEvent.

@IsSendingAsyncMessage(MessageID.USER_ADDED_TO_PROJECT)
private void sendUserAddedToProjectEvent(String projectId, User user) {
    DomainMessage request = new DomainMessage(MessageID.USER_ADDED_TO_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 2 with UserMessage

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

the class UserRoleAdministrationMessageHandler method handleRoleRecalculationRequest.

@IsReceivingAsyncMessage(MessageID.REQUEST_USER_ROLE_RECALCULATION)
private void handleRoleRecalculationRequest(DomainMessage request) {
    UserMessage message = request.get(MessageDataKeys.USER_ID_DATA);
    String userId = message.getUserId();
    userRoleCalculationService.recalculateRolesOfUser(userId);
}
Also used : UserMessage(com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage) IsReceivingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsReceivingAsyncMessage)

Example 3 with UserMessage

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

the class UserRoleCalculationService method sendUserRoleChangedEvent.

@IsSendingAsyncMessage(MessageID.USER_ROLES_CHANGED)
private void sendUserRoleChangedEvent(User user, Set<String> roles) {
    DomainMessage roleChangeRequest = new DomainMessage(MessageID.USER_ROLES_CHANGED);
    UserMessage rolesData = new UserMessage();
    rolesData.setUserId(user.getName());
    rolesData.setRoles(roles);
    roleChangeRequest.set(MessageDataKeys.USER_ROLES_DATA, rolesData);
    eventBus.sendAsynchron(roleChangeRequest);
}
Also used : UserMessage(com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage) DomainMessage(com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage) IsSendingAsyncMessage(com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)

Example 4 with UserMessage

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

the class InternalInitialDataService method informUserCreated.

@IsSendingAsyncMessage(MessageID.USER_CREATED)
private void informUserCreated(User user) {
    DomainMessage infoRequest = new DomainMessage(MessageID.USER_CREATED);
    UserMessage message = createInitialUserAuthData(user);
    infoRequest.set(MessageDataKeys.USER_CREATION_DATA, message);
    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 5 with UserMessage

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

the class InternalInitialDataService method informUserAPITokenChanged.

@IsSendingAsyncMessage(MessageID.USER_API_TOKEN_CHANGED)
private void informUserAPITokenChanged(User user) {
    DomainMessage infoRequest = new DomainMessage(MessageID.USER_API_TOKEN_CHANGED);
    UserMessage message = createInitialUserAuthData(user);
    message.setHashedApiToken(user.getHashedApiToken());
    infoRequest.set(MessageDataKeys.USER_API_TOKEN_DATA, message);
    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)

Aggregations

UserMessage (com.mercedesbenz.sechub.sharedkernel.messaging.UserMessage)38 DomainMessage (com.mercedesbenz.sechub.sharedkernel.messaging.DomainMessage)21 IsReceivingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsReceivingAsyncMessage)11 IsSendingAsyncMessage (com.mercedesbenz.sechub.sharedkernel.messaging.IsSendingAsyncMessage)10 Test (org.junit.Test)8 Test (org.junit.jupiter.api.Test)5 NotAcceptableException (com.mercedesbenz.sechub.sharedkernel.error.NotAcceptableException)2 SimpleMailMessage (org.springframework.mail.SimpleMailMessage)2 Transactional (org.springframework.transaction.annotation.Transactional)2 Validated (org.springframework.validation.annotation.Validated)2 UseCaseAdminDeletesUser (com.mercedesbenz.sechub.sharedkernel.usecases.admin.user.UseCaseAdminDeletesUser)1 UseCaseAdminUpdatesUserEmailAddress (com.mercedesbenz.sechub.sharedkernel.usecases.admin.user.UseCaseAdminUpdatesUserEmailAddress)1