aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-08-27 14:09:29 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-08-27 16:52:32 +0200
commit48b2541ca1ee12c2617da9bb0ae160093e21d084 (patch)
treec3906bb489a658e18e67444c83ec9f23c67a129a /server
parentfbeaa1204ec220543ec1373a2e87ae661c56bd35 (diff)
downloadsonarqube-48b2541ca1ee12c2617da9bb0ae160093e21d084.tar.gz
sonarqube-48b2541ca1ee12c2617da9bb0ae160093e21d084.zip
SONAR-6479 WS permissions/users take out Paging from the loop when building response
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java
index fef9128c304..ef2f9255596 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/UsersAction.java
@@ -36,7 +36,7 @@ import org.sonar.server.permission.PermissionFinder;
import org.sonar.server.permission.UserWithPermissionQueryResult;
import org.sonar.server.permission.ws.PermissionRequest.Builder;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.Common;
+import org.sonarqube.ws.Common.Paging;
import org.sonarqube.ws.Permissions.UsersResponse;
import static com.google.common.base.Objects.firstNonNull;
@@ -105,7 +105,6 @@ public class UsersAction implements PermissionsWsAction {
UsersResponse.Builder userResponse = UsersResponse.newBuilder();
UsersResponse.User.Builder user = UsersResponse.User.newBuilder();
- Common.Paging.Builder paging = Common.Paging.newBuilder();
for (UserWithPermission userWithPermission : usersWithPermission) {
userResponse.addUsers(
user
@@ -114,14 +113,14 @@ public class UsersAction implements PermissionsWsAction {
.setName(nullToEmpty(userWithPermission.name()))
.setEmail(nullToEmpty(userWithPermission.email()))
.setSelected(userWithPermission.hasPermission()));
- userResponse.setPaging(
- paging
- .clear()
- .setPageIndex(page)
- .setPageSize(pageSize)
- .setTotal(usersResult.total())
- );
}
+ userResponse.setPaging(
+ Paging.newBuilder()
+ .clear()
+ .setPageIndex(page)
+ .setPageSize(pageSize)
+ .setTotal(usersResult.total())
+ );
return userResponse.build();
}