Search in sources :

Example 21 with Paging

use of org.sonar.api.utils.Paging in project sonarqube by SonarSource.

the class QgateProjectFinder method find.

public Association find(ProjectQgateAssociationQuery query) {
    try (DbSession dbSession = dbClient.openSession(false)) {
        getQualityGateId(dbSession, query.gateId());
        List<ProjectQgateAssociationDto> projects = associationDao.selectProjects(dbSession, query);
        List<ProjectQgateAssociationDto> authorizedProjects = keepAuthorizedProjects(dbSession, projects);
        Paging paging = forPageIndex(query.pageIndex()).withPageSize(query.pageSize()).andTotal(authorizedProjects.size());
        return new Association(toProjectAssociations(getPaginatedProjects(authorizedProjects, paging)), paging.hasNextPage());
    }
}
Also used : DbSession(org.sonar.db.DbSession) ProjectQgateAssociation(org.sonar.db.qualitygate.ProjectQgateAssociation) Paging(org.sonar.api.utils.Paging) ProjectQgateAssociationDto(org.sonar.db.qualitygate.ProjectQgateAssociationDto)

Aggregations

Paging (org.sonar.api.utils.Paging)21 DbSession (org.sonar.db.DbSession)15 ComponentDto (org.sonar.db.component.ComponentDto)7 PermissionQuery (org.sonar.db.permission.PermissionQuery)4 UserDto (org.sonar.db.user.UserDto)4 SearchOptions (org.sonar.server.es.SearchOptions)4 ComponentQuery (org.sonar.db.component.ComponentQuery)3 OrganizationDto (org.sonar.db.organization.OrganizationDto)3 GroupDto (org.sonar.db.user.GroupDto)3 SearchResponse (org.elasticsearch.action.search.SearchResponse)2 JsonWriter (org.sonar.api.utils.text.JsonWriter)2 PermissionTemplateDto (org.sonar.db.permission.template.PermissionTemplateDto)2 ProjectQgateAssociationDto (org.sonar.db.qualitygate.ProjectQgateAssociationDto)2 Facets (org.sonar.server.es.Facets)2 UsersWsResponse (org.sonarqube.ws.Permissions.UsersWsResponse)2 Collection (java.util.Collection)1 Comparator.comparing (java.util.Comparator.comparing)1 List (java.util.List)1 Set (java.util.Set)1 Change (org.sonar.api.server.ws.Change)1