diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-12-17 16:19:44 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-12-21 12:27:25 +0100 |
commit | 6fe8b0cd64c4b4e2386d994016b465b0386ed09c (patch) | |
tree | 73006c620bed41a2849e4d563aa8c1981de7c38d /sonar-plugin-api | |
parent | 8239ac084eb9aaaba9f661a4e2fe5891bda8d452 (diff) | |
download | sonarqube-6fe8b0cd64c4b4e2386d994016b465b0386ed09c.tar.gz sonarqube-6fe8b0cd64c4b4e2386d994016b465b0386ed09c.zip |
SONAR-7129 WS api/components/tree
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java | 17 | ||||
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java | 4 |
2 files changed, 20 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java index 0fe59142154..6dd6c57898a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java @@ -411,8 +411,23 @@ public interface WebService extends Definable<WebService.Context> { * Add predefined parameters related to sorting of results. */ public <V> NewAction addSortParams(Collection<V> possibleValues, @Nullable V defaultValue, boolean defaultAscending) { + genericAddSortParam(possibleValues, defaultValue, defaultAscending, "Sort field"); + + return this; + } + + /** + * Add predefined parameters related to sorting of results. Comma-separated list + */ + public <V> NewAction addMultiSortsParams(Collection<V> possibleValues, @Nullable V defaultValue, boolean defaultAscending) { + genericAddSortParam(possibleValues, defaultValue, defaultAscending, "Comma-separated list of sort fields"); + + return this; + } + + public <V> NewAction genericAddSortParam(Collection<V> possibleValues, @Nullable V defaultValue, boolean defaultAscending, String description) { createParam(Param.SORT) - .setDescription("Sort field") + .setDescription(description) .setDeprecatedKey("sort") .setDefaultValue(defaultValue) .setPossibleValues(possibleValues); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java index d9439514a3c..f9b49c528c3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/Paging.java @@ -82,6 +82,10 @@ public class Paging { return (pageIndex - 1) * pageSize; } + public static int offset(int pageIndex, int pageSize) { + return (pageIndex - 1) * pageSize; + } + /** * Number of pages. It is greater than or equal 0. */ |