Search in sources :

Example 1 with Dto

use of org.sonar.server.permission.index.PermissionIndexerDao.Dto in project sonarqube by SonarSource.

the class PermissionIndexer method index.

private void index(Collection<PermissionIndexerDao.Dto> authorizations, AuthorizationScope scope, Size bulkSize) {
    IndexType indexType = scope.getIndexType();
    BulkIndexer bulkIndexer = new BulkIndexer(esClient, indexType.getIndex());
    bulkIndexer.setSize(bulkSize);
    bulkIndexer.start();
    authorizations.stream().filter(scope.getProjectPredicate()).map(dto -> newIndexRequest(dto, indexType)).forEach(bulkIndexer::add);
    bulkIndexer.stop();
}
Also used : Arrays(java.util.Arrays) Collection(java.util.Collection) Set(java.util.Set) Collectors(org.sonar.core.util.stream.Collectors) HashMap(java.util.HashMap) Collectors.toSet(org.sonar.core.util.stream.Collectors.toSet) BulkIndexer(org.sonar.server.es.BulkIndexer) DbSession(org.sonar.db.DbSession) EsClient(org.sonar.server.es.EsClient) DbClient(org.sonar.db.DbClient) List(java.util.List) IndexRequest(org.elasticsearch.action.index.IndexRequest) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Stream(java.util.stream.Stream) DateUtils(org.sonar.api.utils.DateUtils) Dto(org.sonar.server.permission.index.PermissionIndexerDao.Dto) Map(java.util.Map) Size(org.sonar.server.es.BulkIndexer.Size) ProjectIndexer(org.sonar.server.es.ProjectIndexer) VisibleForTesting(com.google.common.annotations.VisibleForTesting) StartupIndexer(org.sonar.server.es.StartupIndexer) IndexType(org.sonar.server.es.IndexType) IndexType(org.sonar.server.es.IndexType) BulkIndexer(org.sonar.server.es.BulkIndexer)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Stream (java.util.stream.Stream)1 IndexRequest (org.elasticsearch.action.index.IndexRequest)1 DateUtils (org.sonar.api.utils.DateUtils)1 Collectors (org.sonar.core.util.stream.Collectors)1 Collectors.toSet (org.sonar.core.util.stream.Collectors.toSet)1 DbClient (org.sonar.db.DbClient)1 DbSession (org.sonar.db.DbSession)1 BulkIndexer (org.sonar.server.es.BulkIndexer)1 Size (org.sonar.server.es.BulkIndexer.Size)1 EsClient (org.sonar.server.es.EsClient)1 IndexType (org.sonar.server.es.IndexType)1 ProjectIndexer (org.sonar.server.es.ProjectIndexer)1