diff options
3 files changed, 10 insertions, 4 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java index 270a336fe3f..9f99a1d8d95 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java @@ -64,7 +64,8 @@ public class SearchAction implements UsersWsAction { .setHandler(this) .setResponseExample(getClass().getResource("search-example.json")); - action.addFieldsParam(UserJsonWriter.FIELDS); + action.createFieldsParam(UserJsonWriter.FIELDS) + .setDeprecatedSince("5.4"); action.addPagingParams(50, MAX_LIMIT); action.createParam(Param.TEXT_QUERY) diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/UserJsonWriter.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/UserJsonWriter.java index b4711a075fd..6958a6aebc1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/UserJsonWriter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/UserJsonWriter.java @@ -21,6 +21,7 @@ package org.sonar.server.user.ws; import com.google.common.collect.ImmutableSet; import java.util.Collection; +import java.util.Collections; import java.util.Set; import javax.annotation.Nullable; import org.sonar.api.user.User; @@ -80,7 +81,7 @@ public class UserJsonWriter { if (user == null) { json.beginObject().endObject(); } else { - write(json, user, ImmutableSet.<String>of(), CONCISE_FIELDS); + write(json, user, Collections.<String>emptySet(), CONCISE_FIELDS); } } 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 eb65e536154..a82771df076 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 @@ -387,10 +387,14 @@ public interface WebService extends Definable<WebService.Context> { * used to restrict the number of fields returned in JSON response. */ public NewAction addFieldsParam(Collection<?> possibleValues) { - createParam(Param.FIELDS) + createFieldsParam(possibleValues); + return this; + } + + public NewParam createFieldsParam(Collection<?> possibleValues) { + return createParam(Param.FIELDS) .setDescription("Comma-separated list of the fields to be returned in response. All the fields are returned by default.") .setPossibleValues(possibleValues); - return this; } /**$ |