Search in sources :

Example 1 with OrganizationQuery

use of org.sonar.db.organization.OrganizationQuery in project sonarqube by SonarSource.

the class SearchAction method handle.

@Override
public void handle(Request request, Response response) throws Exception {
    try (DbSession dbSession = dbClient.openSession(false)) {
        Paging paging = Paging.forPageIndex(request.mandatoryParamAsInt(Param.PAGE)).withPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE)).andTotal(0);
        OrganizationQuery organizationQuery = newOrganizationQueryBuilder().setKeys(request.paramAsStrings(PARAM_ORGANIZATIONS)).build();
        List<OrganizationDto> dtos = dbClient.organizationDao().selectByQuery(dbSession, organizationQuery, paging.offset(), paging.pageSize());
        writeResponse(request, response, dtos);
    }
}
Also used : DbSession(org.sonar.db.DbSession) Paging(org.sonar.api.utils.Paging) OrganizationQuery(org.sonar.db.organization.OrganizationQuery) OrganizationDto(org.sonar.db.organization.OrganizationDto)

Aggregations

Paging (org.sonar.api.utils.Paging)1 DbSession (org.sonar.db.DbSession)1 OrganizationDto (org.sonar.db.organization.OrganizationDto)1 OrganizationQuery (org.sonar.db.organization.OrganizationQuery)1