use of org.sonar.server.es.ProjectIndexer.Cause.PROJECT_TAGS_UPDATE in project sonarqube by SonarSource.
the class SetAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
String projectKey = request.mandatoryParam(PARAM_PROJECT);
List<String> tags = request.mandatoryParamAsStrings(PARAM_TAGS).stream().filter(StringUtils::isNotBlank).map(t -> t.toLowerCase(Locale.ENGLISH)).map(SetAction::checkTag).distinct().collect(Collectors.toList());
try (DbSession dbSession = dbClient.openSession(false)) {
ComponentDto project = componentFinder.getByKey(dbSession, projectKey);
checkRequest(project.isRootProject(), "Component must be a project");
userSession.checkComponentUuidPermission(UserRole.ADMIN, project.uuid());
project.setTags(tags);
dbClient.componentDao().updateTags(dbSession, project);
dbSession.commit();
indexers.forEach(i -> i.indexProject(project.uuid(), PROJECT_TAGS_UPDATE));
}
response.noContent();
}
Aggregations