use of com.epam.ta.reportportal.core.events.activity.ProjectAnalyzerConfigEvent in project service-api by reportportal.
the class UpdateProjectHandlerImpl method updateProject.
@Override
public OperationCompletionRS updateProject(String projectName, UpdateProjectRQ updateProjectRQ, ReportPortalUser user) {
Project project = projectRepository.findByName(projectName).orElseThrow(() -> new ReportPortalException(ErrorType.PROJECT_NOT_FOUND, projectName));
ProjectAttributesActivityResource before = TO_ACTIVITY_RESOURCE.apply(project);
updateProjectConfiguration(updateProjectRQ.getConfiguration(), project);
ofNullable(updateProjectRQ.getUserRoles()).ifPresent(roles -> updateProjectUserRoles(roles, project, user));
projectRepository.save(project);
ProjectAttributesActivityResource after = TO_ACTIVITY_RESOURCE.apply(project);
applicationEventPublisher.publishEvent(new ProjectEvent(project.getId(), UPDATE_EVENT));
messageBus.publishActivity(new ProjectUpdatedEvent(before, after, user.getUserId(), user.getUsername()));
messageBus.publishActivity(new ProjectAnalyzerConfigEvent(before, after, user.getUserId(), user.getUsername()));
return new OperationCompletionRS("Project with name = '" + project.getName() + "' is successfully updated.");
}
Aggregations