*/
package org.sonar.ce.task.projectanalysis.purge;
-import java.util.Collection;
import java.util.List;
import org.sonar.api.server.ServerSide;
import org.sonar.db.purge.PurgeListener;
-import org.sonar.server.component.index.EntityDefinitionIndexer;
import org.sonar.server.issue.index.IssueIndexer;
@ServerSide
public class IndexPurgeListener implements PurgeListener {
private final IssueIndexer issueIndexer;
- private final EntityDefinitionIndexer entityDefinitionIndexer;
- public IndexPurgeListener(IssueIndexer issueIndexer, EntityDefinitionIndexer entityDefinitionIndexer) {
+ public IndexPurgeListener(IssueIndexer issueIndexer) {
this.issueIndexer = issueIndexer;
- this.entityDefinitionIndexer = entityDefinitionIndexer;
- }
-
- @Override
- public void onComponentsDisabling(String projectUuid, Collection<String> disabledComponentUuids) {
- entityDefinitionIndexer.delete(projectUuid, disabledComponentUuids);
}
@Override
*/
package org.sonar.ce.task.projectanalysis.purge;
-import java.util.List;
import org.junit.Test;
import org.sonar.server.component.index.EntityDefinitionIndexer;
import org.sonar.server.issue.index.IssueIndexer;
import static java.util.Arrays.asList;
-import static java.util.Collections.singletonList;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
public class IndexPurgeListenerTest {
private IssueIndexer issueIndexer = mock(IssueIndexer.class);
- private EntityDefinitionIndexer entityDefinitionIndexer = mock(EntityDefinitionIndexer.class);
-
- private IndexPurgeListener underTest = new IndexPurgeListener(issueIndexer, entityDefinitionIndexer);
-
- @Test
- public void test_onComponentDisabling() {
- String uuid = "123456";
- String projectUuid = "P789";
- List<String> uuids = singletonList(uuid);
- underTest.onComponentsDisabling(projectUuid, uuids);
-
- verify(entityDefinitionIndexer).delete(projectUuid, uuids);
- }
+ private IndexPurgeListener underTest = new IndexPurgeListener(issueIndexer);
@Test
public void test_onIssuesRemoval() {
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.time.ZoneOffset.UTC;
import static java.util.Arrays.asList;
-import static java.util.Collections.emptySet;
import static java.util.Collections.singletonList;
import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.groups.Tuple.tuple;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
import static org.sonar.db.ce.CeTaskTypes.REPORT;
purgeListener, new PurgeProfiler());
dbSession.commit();
- verify(purgeListener).onComponentsDisabling(mainBranch.uuid(), selectedComponentUuids);
- verify(purgeListener).onComponentsDisabling(mainBranch.uuid(), ImmutableSet.of(dir.uuid()));
-
// set purge_status=1 for non-last snapshot
assertThat(db.countSql("select count(*) from snapshots where purge_status = 1")).isOne();
.extracting("uuid")
.containsOnly(mainBranch.uuid(), enabledFileWithIssues.uuid(), disabledFileWithIssues.uuid(),
enabledFileWithoutIssues.uuid());
- verify(purgeListener).onComponentsDisabling(mainBranch.uuid(), disabledComponentUuids);
}
@Test
public class BranchDto {
public static final String DEFAULT_MAIN_BRANCH_NAME = "main";
- /**
- * The only use of this constant is for applications that were created before SQ 9.8. Sometimes (in example during XML import of
- * portfolios and applications) we don't have access to default branch name of the application so we default to "master".
- */
- public static final String OLD_DEFAULT_MAIN_BRANCH_NAME = "master";
/**
* Maximum length of column "kee"
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.annotation.Nullable;
import org.sonar.api.utils.System2;
import org.sonar.db.DbSession;
}
void purgeDisabledComponents(String rootComponentUuid, Collection<String> disabledComponentUuids, PurgeListener listener) {
- Set<String> missedDisabledComponentUuids = new HashSet<>();
profiler.start("purgeDisabledComponents (file_sources)");
- missedDisabledComponentUuids.addAll(
executeLargeInputs(
purgeMapper.selectDisabledComponentsWithFileSource(rootComponentUuid),
input -> {
purgeMapper.deleteFileSourcesByFileUuid(input);
return input;
- }));
+ });
profiler.stop();
profiler.start("purgeDisabledComponents (unresolved_issues)");
- missedDisabledComponentUuids.addAll(
executeLargeInputs(
purgeMapper.selectDisabledComponentsWithUnresolvedIssues(rootComponentUuid),
input -> {
purgeMapper.resolveComponentIssuesNotAlreadyResolved(input, system2.now());
return input;
- }));
+ });
profiler.stop();
profiler.start("purgeDisabledComponents (live_measures)");
- missedDisabledComponentUuids.addAll(
executeLargeInputs(
purgeMapper.selectDisabledComponentsWithLiveMeasures(rootComponentUuid),
input -> {
purgeMapper.deleteLiveMeasuresByComponentUuids(input);
return input;
- }));
+ });
profiler.stop();
session.commit();
-
- // notify listener for any disabled component we found child data for which isn't part of the disabled components
- // provided
- missedDisabledComponentUuids.removeAll(disabledComponentUuids);
- if (!missedDisabledComponentUuids.isEmpty()) {
- listener.onComponentsDisabling(rootComponentUuid, missedDisabledComponentUuids);
- }
}
private void deleteAnalysisDuplications(List<List<String>> snapshotUuidsPartitions) {
private static void purgeDisabledComponents(PurgeCommands commands, PurgeConfiguration conf, PurgeListener listener) {
String rootUuid = conf.rootUuid();
- listener.onComponentsDisabling(rootUuid, conf.getDisabledComponentUuids());
commands.purgeDisabledComponents(rootUuid, conf.getDisabledComponentUuids(), listener);
}
*/
package org.sonar.db.purge;
-import java.util.Collection;
import java.util.List;
public interface PurgeListener {
PurgeListener EMPTY = new PurgeListener() {
- @Override
- public void onComponentsDisabling(String uuid, Collection<String> disabledComponentUuids) {
- // do nothing
- }
-
@Override
public void onIssuesRemoval(String projectUuid, List<String> issueKeys) {
// do nothing
}
};
- void onComponentsDisabling(String uuid, Collection<String> disabledComponentUuids);
-
void onIssuesRemoval(String projectUuid, List<String> issueKeys);
}
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
import org.sonar.db.component.BranchDto;
-import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ProjectData;
import org.sonar.db.entity.EntityDto;
import org.sonar.db.es.EsQueueDto;
import static org.sonar.api.resources.Qualifiers.PROJECT;
import static org.sonar.server.component.index.ComponentIndexDefinition.FIELD_NAME;
import static org.sonar.server.component.index.ComponentIndexDefinition.TYPE_COMPONENT;
-import static org.sonar.server.es.Indexers.EntityEvent.PERMISSION_CHANGE;
import static org.sonar.server.es.Indexers.EntityEvent.CREATION;
import static org.sonar.server.es.Indexers.EntityEvent.DELETION;
+import static org.sonar.server.es.Indexers.EntityEvent.PERMISSION_CHANGE;
import static org.sonar.server.es.Indexers.EntityEvent.PROJECT_TAGS_UPDATE;
import static org.sonar.server.es.newindex.DefaultIndexSettingsElement.SORTABLE_ANALYZER;
assertThat(result.getSuccess()).isOne();
}
- @Test
- public void delete_some_components() {
- ProjectDto project = db.components().insertPrivateProject().getProjectDto();
- indexProject(project, CREATION);
-
- underTest.delete(project.getUuid(), emptySet());
-
- assertThatIndexContainsOnly(project);
- }
-
@Test
public void delete_project() {
ProjectDto project = db.components().insertPrivateProject().getProjectDto();
import org.sonar.api.utils.System2;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
+import org.sonar.db.component.BranchDto;
import org.sonar.db.component.ComponentDto;
+import org.sonar.db.component.ProjectData;
import org.sonar.db.component.SnapshotDto;
import org.sonar.db.es.EsQueueDto;
import org.sonar.db.project.ProjectDto;
@Test
public void indexOnAnalysis_indexes_provisioned_project() {
- ProjectDto project1 = db.components().insertPrivateProject().getProjectDto();
- ProjectDto project2 = db.components().insertPrivateProject().getProjectDto();
+ ProjectData project1 = db.components().insertPrivateProject();
+ ProjectData project2 = db.components().insertPrivateProject();
+
+ underTest.indexOnAnalysis(project1.getMainBranchComponent().uuid());
- underTest.indexOnAnalysis(project1.getUuid());
+ assertThatIndexContainsOnly(project1.getProjectDto());
+ }
+
+ @Test
+ public void indexOnAnalysis_whenPassingANonMainBranch_ShouldNotIndexProject() {
+ ProjectData project1 = db.components().insertPrivateProject();
+ ProjectData project2 = db.components().insertPrivateProject();
+ BranchDto branchDto = db.components().insertProjectBranch(project1.getProjectDto());
+ underTest.indexOnAnalysis(branchDto.getUuid());
- assertThatIndexContainsOnly(project1);
+ assertThatIndexContainsOnly(new ProjectDto[]{});
}
@Test
public void indexOnAnalysis_indexes_provisioned_application() {
- ProjectDto app1 = db.components().insertPrivateApplication().getProjectDto();
- ProjectDto app2 = db.components().insertPrivateApplication().getProjectDto();
+ ProjectData app1 = db.components().insertPrivateApplication();
+ ProjectData app2 = db.components().insertPrivateApplication();
- underTest.indexOnAnalysis(app1.getUuid());
+ underTest.indexOnAnalysis(app1.getMainBranchComponent().uuid());
- assertThatIndexContainsOnly(app1);
+ assertThatIndexContainsOnly(app1.getProjectDto());
}
@Test
package org.sonar.server.component.index;
import com.google.common.annotations.VisibleForTesting;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
// measures, tags and permissions does not affect the definition of entities
emptyList();
case CREATION, DELETION, PROJECT_KEY_UPDATE -> {
- List<EsQueueDto> items = entityUuids.stream()
- .map(entityUuid -> EsQueueDto.create(TYPE_COMPONENT.format(), entityUuid, null, entityUuid))
- .collect(MoreCollectors.toArrayList(entityUuids.size()));
+ List<EsQueueDto> items = createEsQueueDtosFromEntities(entityUuids);
yield dbClient.esQueueDao().insert(dbSession, items);
}
};
}
+ private static ArrayList<EsQueueDto> createEsQueueDtosFromEntities(Collection<String> entityUuids) {
+ return entityUuids.stream()
+ .map(entityUuid -> EsQueueDto.create(TYPE_COMPONENT.format(), entityUuid, null, entityUuid))
+ .collect(MoreCollectors.toArrayList(entityUuids.size()));
+ }
+
@Override
public Collection<EsQueueDto> prepareForRecoveryOnBranchEvent(DbSession dbSession, Collection<String> branchUuids, Indexers.BranchEvent cause) {
return emptyList();
bulkIndexer.addDeletion(searchRequest);
}
- public void delete(String projectUuid, Collection<String> disabledComponentUuids) {
- BulkIndexer bulk = new BulkIndexer(esClient, TYPE_COMPONENT, Size.REGULAR);
- bulk.start();
- disabledComponentUuids.forEach(uuid -> bulk.addDeletion(TYPE_COMPONENT, uuid, AuthorizationDoc.idOf(projectUuid)));
- bulk.stop();
- }
-
@VisibleForTesting
void index(EntityDto... docs) {
BulkIndexer bulk = new BulkIndexer(esClient, TYPE_COMPONENT, Size.REGULAR);
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.es;
-
-import java.util.Collection;
-import java.util.Set;
-import org.sonar.db.DbSession;
-import org.sonar.db.es.EsQueueDto;
-
-public interface BranchIndexer extends ResilientIndexer {
-
- enum Cause {
- CREATION,
- DELETION,
- MEASURE_CHANGE
- }
-
- /**
- * This method is called when an analysis must be indexed.
- *
- * @param branchUuid UUID of a project or application branch, or the UUID of a portfolio.
- */
- void indexBranchOnAnalysis(String branchUuid);
-
- void indexBranchOnAnalysis(String branchUuid, Set<String> unchangedComponentUuids);
-
- Collection<EsQueueDto> prepareBranchIndexForRecovery(DbSession dbSession, Collection<String> branchUuids, BranchIndexer.Cause cause);
-}
import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Collectors;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.search.builder.SearchSourceBuilder;
};
}
- private List<EsQueueDto> createProjectDeleteRecoveryItems(Collection<String> entityUuids) {
+ private static List<EsQueueDto> createProjectDeleteRecoveryItems(Collection<String> entityUuids) {
return entityUuids.stream()
.map(entityUuid -> createQueueDto(entityUuid, ID_TYPE_DELETE_PROJECT_UUID, entityUuid))
- .collect(Collectors.toList());
+ .toList();
}
- private List<EsQueueDto> createBranchRecoveryItems(Collection<String> branchUuids) {
+ private static List<EsQueueDto> createBranchRecoveryItems(Collection<String> branchUuids) {
return branchUuids.stream()
.map(branchUuid -> createQueueDto(branchUuid, ID_TYPE_BRANCH_UUID, branchUuid))
- .collect(Collectors.toList());
+ .toList();
}
/**
import java.util.Date;
import java.util.Iterator;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
// nothing to do, permissions are not used in index type projectmeasures/projectmeasure
Collections.emptyList();
case PROJECT_KEY_UPDATE, CREATION, PROJECT_TAGS_UPDATE, DELETION ->
- // when MEASURE_CHANGE or PROJECT_KEY_UPDATE project must be re-indexed because key is used in this index
- // when PROJECT_CREATION provisioned projects are supported by WS api/components/search_projects
+ // when CREATION provisioned projects are supported by WS api/components/search_projects
prepareForRecovery(dbSession, entityUuids);
};
}
return switch (cause) {
case DELETION -> Collections.emptyList();
case MEASURE_CHANGE -> {
+ // when MEASURE_CHANGE or PROJECT_KEY_UPDATE project must be re-indexed because key is used in this index
Set<String> entityUuids = dbClient.branchDao().selectByUuids(dbSession, branchUuids)
.stream().map(BranchDto::getProjectUuid)
.collect(Collectors.toSet());
return bulkIndexer.stop();
}
- private void doIndex(Size size, @Nullable String projectUuid) {
- try (DbSession dbSession = dbClient.openSession(false);
- ProjectMeasuresIndexerIterator rowIt = ProjectMeasuresIndexerIterator.create(dbSession, projectUuid)) {
+ private void doIndex(Size size, @Nullable String branchUuid) {
+
- BulkIndexer bulkIndexer = createBulkIndexer(size, IndexingListener.FAIL_ON_ERROR);
- bulkIndexer.start();
- while (rowIt.hasNext()) {
- ProjectMeasures doc = rowIt.next();
- bulkIndexer.add(toProjectMeasuresDoc(doc).toIndexRequest());
+ try (DbSession dbSession = dbClient.openSession(false)) {
+ String projectUuid = null;
+ if (branchUuid != null) {
+ Optional<BranchDto> branchDto = dbClient.branchDao().selectByUuid(dbSession, branchUuid);
+ if (branchDto.isEmpty() || !branchDto.get().isMain()) {
+ return;
+ } else {
+ projectUuid = branchDto.get().getProjectUuid();
+ }
+ }
+
+ try (ProjectMeasuresIndexerIterator rowIt = ProjectMeasuresIndexerIterator.create(dbSession, projectUuid)) {
+ BulkIndexer bulkIndexer = createBulkIndexer(size, IndexingListener.FAIL_ON_ERROR);
+ bulkIndexer.start();
+ while (rowIt.hasNext()) {
+ ProjectMeasures doc = rowIt.next();
+ bulkIndexer.add(toProjectMeasuresDoc(doc).toIndexRequest());
+ }
+ bulkIndexer.stop();
}
- bulkIndexer.stop();
}
}
public Collection<EsQueueDto> prepareForRecoveryOnEntityEvent(DbSession dbSession, Collection<String> entityUuids, Indexers.EntityEvent cause) {
return switch (cause) {
case PROJECT_KEY_UPDATE, PROJECT_TAGS_UPDATE ->
- // nothing to change. Measures, project key and tags are not part of this index
+ // nothing to change. project key and tags are not part of this index
emptyList();
case CREATION, DELETION, PERMISSION_CHANGE -> insertIntoEsQueue(dbSession, entityUuids);
};
*/
package org.sonar.server.permission.index;
+import java.util.Optional;
import java.util.Set;
import org.elasticsearch.action.index.IndexRequest;
+import org.sonar.db.DbClient;
+import org.sonar.db.DbSession;
+import org.sonar.db.component.BranchDto;
import org.sonar.server.es.AnalysisIndexer;
import org.sonar.server.es.BaseDoc;
import org.sonar.server.es.EsClient;
private static final AuthorizationScope AUTHORIZATION_SCOPE = new AuthorizationScope(TYPE_FOO, p -> true);
private final EsClient esClient;
+ private final DbClient dbClient;
- public FooIndexer(EsClient esClient) {
+ public FooIndexer(EsClient esClient, DbClient dbClient) {
this.esClient = esClient;
+ this.dbClient = dbClient;
}
@Override
@Override
public void indexOnAnalysis(String branchUuid, Set<String> unchangedComponentUuids) {
- addToIndex(branchUuid, "bar");
- addToIndex(branchUuid, "baz");
+ try(DbSession dbSession = dbClient.openSession(true)){
+ Optional<BranchDto> branchDto = dbClient.branchDao().selectByUuid(dbSession, branchUuid);
+ if (branchDto.isEmpty()) {
+ //For portfolio, adding branchUuid directly
+ addToIndex(branchUuid, "bar");
+ addToIndex(branchUuid, "baz");
+ }else{
+ addToIndex(branchDto.get().getProjectUuid(), "bar");
+ addToIndex(branchDto.get().getProjectUuid(), "baz");
+ }
+ }
+
+
}
private void addToIndex(String projectUuid, String name) {
import org.sonar.api.utils.System2;
import org.sonar.db.DbSession;
import org.sonar.db.DbTester;
+import org.sonar.db.component.ProjectData;
import org.sonar.db.entity.EntityDto;
import org.sonar.db.es.EsQueueDto;
import org.sonar.db.portfolio.PortfolioDto;
public UserSessionRule userSession = UserSessionRule.standalone();
private FooIndex fooIndex = new FooIndex(es.client(), new WebAuthorizationTypeSupport(userSession));
- private FooIndexer fooIndexer = new FooIndexer(es.client());
+ private FooIndexer fooIndexer = new FooIndexer(es.client(), db.getDbClient());
private PermissionIndexer underTest = new PermissionIndexer(db.getDbClient(), es.client(), fooIndexer);
@Test
}
private ProjectDto createAndIndexPrivateProject() {
- ProjectDto project = db.components().insertPrivateProject().getProjectDto();
- fooIndexer.indexOnAnalysis(project.getUuid());
- return project;
+ ProjectData project = db.components().insertPrivateProject();
+ fooIndexer.indexOnAnalysis(project.getMainBranchDto().getUuid());
+ return project.getProjectDto();
}
private ProjectDto createAndIndexPublicProject() {
- ProjectDto project = db.components().insertPublicProject().getProjectDto();
- fooIndexer.indexOnAnalysis(project.getUuid());
- return project;
+ ProjectData project = db.components().insertPublicProject();
+ fooIndexer.indexOnAnalysis(project.getMainBranchDto().getUuid());
+ return project.getProjectDto();
}
private PortfolioDto createAndIndexPortfolio() {
import org.sonar.db.DbSession;
import org.sonar.db.project.ProjectDto;
import org.sonar.db.pushevent.PushEventDto;
-import org.sonar.server.es.EventIndexer;
import org.sonar.server.es.Indexers;
import org.sonar.server.project.Project;
import org.sonar.server.project.ProjectLifeCycleListeners;
NewAction action = controller.createAction("authors")
.setSince("5.1")
.setDescription("Search SCM accounts which match a given query.<br/>" +
- "Requires authentication."
- + "<br/>When issue indexation is in progress returns 503 service unavailable HTTP code.")
+ "Requires authentication."
+ + "<br/>When issue indexation is in progress returns 503 service unavailable HTTP code.")
.setResponseExample(Resources.getResource(this.getClass(), "authors-example.json"))
.setChangelog(new Change("7.4", "The maximum size of 'ps' is set to 100"))
.setHandler(this);
private List<String> getAuthors(DbSession session, @Nullable EntityDto entity, Request request) {
IssueQuery.Builder issueQueryBuilder = IssueQuery.builder();
- ofNullable(entity).ifPresent(e -> {
- switch (e.getQualifier()) {
- case Qualifiers.PROJECT -> issueQueryBuilder.projectUuids(Set.of(e.getUuid()));
- case Qualifiers.VIEW -> issueQueryBuilder.viewUuids(Set.of(e.getUuid()));
+ ofNullable(entity).ifPresent(p -> {
+ switch (p.getQualifier()) {
+ case Qualifiers.PROJECT -> issueQueryBuilder.projectUuids(Set.of(p.getUuid()));
+ case Qualifiers.VIEW -> issueQueryBuilder.viewUuids(Set.of(p.getUuid()));
case Qualifiers.APP -> {
- BranchDto appMainBranch = dbClient.branchDao().selectMainBranchByProjectUuid(session, e.getUuid())
- .orElseThrow(() -> new IllegalStateException("Couldn't find main branch for APP " + e.getUuid()));
- issueQueryBuilder.viewUuids(Set.of(entity.getUuid()));
- issueQueryBuilder.branchUuid(appMainBranch.getUuid());
+ BranchDto appMainBranch = dbClient.branchDao().selectMainBranchByProjectUuid(session, entity.getUuid())
+ .orElseThrow(() -> new IllegalStateException("Couldn't find main branch for APP " + entity.getUuid()));
+ issueQueryBuilder.viewUuids(Set.of(appMainBranch.getUuid()));
}
- default -> throw new IllegalArgumentException(String.format("Component of type '%s' is not supported", e.getQualifier()));
+ default -> throw new IllegalArgumentException(String.format("Component of type '%s' is not supported", p.getQualifier()));
}
});
return issueIndex.searchAuthors(
import java.util.Optional;
import java.util.Set;
import javax.annotation.CheckForNull;
+import org.slf4j.LoggerFactory;
import org.sonar.api.config.Configuration;
import org.sonar.api.measures.Metric;
-import org.slf4j.LoggerFactory;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.component.BranchDto;
import org.sonar.db.measure.LiveMeasureDto;
import org.sonar.db.metric.MetricDto;
import org.sonar.db.project.ProjectDto;
-import org.sonar.server.es.EventIndexer;
import org.sonar.server.es.Indexers;
import org.sonar.server.qualitygate.EvaluatedQualityGate;
import org.sonar.server.qualitygate.QualityGate;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.entity.EntityDto;
-import org.sonar.db.project.ProjectDto;
import org.sonar.server.component.ComponentCreationData;
import org.sonar.server.component.ComponentUpdater;
import org.sonar.server.newcodeperiod.NewCodeDefinitionResolver;
import org.sonar.db.permission.UserPermissionDto;
import org.sonar.db.user.GroupDto;
import org.sonar.db.user.UserId;
-import org.sonar.server.es.EventIndexer;
import org.sonar.server.es.Indexers;
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.project.Visibility;