import org.sonar.api.server.ws.RequestHandler;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
+import org.sonar.api.server.ws.WebService.Param;
import org.sonar.api.utils.text.JsonWriter;
import org.sonar.api.web.UserRole;
import org.sonar.core.component.ComponentDto;
private static final short MINIMUM_SEARCH_CHARACTERS = 2;
private static final String PARAM_COMPONENT_UUID = "componentUuid";
- private static final String PARAM_QUERY = "q";
private final DbClient dbClient;
.setExampleValue("d6d9e1e5-5e13-44fa-ab82-3ec29efa8935");
action
- .createParam(PARAM_QUERY)
+ .createParam(Param.TEXT_QUERY)
.setRequired(true)
.setDescription("UTF-8 search query")
.setExampleValue("sonar");
@Override
public void handle(Request request, Response response) {
- String query = request.mandatoryParam(PARAM_QUERY);
+ String query = request.mandatoryParam(Param.TEXT_QUERY);
if (query.length() < MINIMUM_SEARCH_CHARACTERS) {
throw new IllegalArgumentException(String.format("Minimum search is %s characters", MINIMUM_SEARCH_CHARACTERS));
}
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.server.ws.WebService.NewAction;
+import org.sonar.api.server.ws.WebService.Param;
import org.sonar.api.utils.text.JsonWriter;
import org.sonar.server.issue.IssueService;
.setSince("5.1")
.setDescription("List tags matching a given query")
.setResponseExample(Resources.getResource(getClass(), "example-tags.json"));
- action.createParam("q")
+ action.createParam(Param.TEXT_QUERY)
.setDescription("A pattern to match tags against")
.setExampleValue("misra");
action.createParam("ps")
@Override
public void handle(Request request, Response response) throws Exception {
- String query = request.param("q");
+ String query = request.param(Param.TEXT_QUERY);
int pageSize = request.mandatoryParamAsInt("ps");
JsonWriter json = response.newJsonWriter().beginObject().name("tags").beginArray();
for (String tag: service.listTags(query, pageSize)) {
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.server.ws.WebService.NewAction;
+import org.sonar.api.server.ws.WebService.Param;
import org.sonar.api.utils.text.JsonWriter;
import org.sonar.core.qualityprofile.db.QualityProfileDao;
import org.sonar.core.util.NonNullInputFunction;
FIELD_PROJECT_COUNT);
private static final String PARAM_LANGUAGE = FIELD_LANGUAGE;
- private static final String PARAM_FIELDS = "f";
-
private final Languages languages;
.setExampleValue("js")
.setPossibleValues(LanguageParamUtils.getLanguageKeys(languages));
- search.createParam(PARAM_FIELDS)
+ search.createParam(Param.FIELDS)
.setDescription("Use to restrict returned fields.")
.setExampleValue("key,language")
.setPossibleValues(ALL_FIELDS);
@Override
public void handle(Request request, Response response) throws Exception {
- List<String> fields = request.paramAsStrings(PARAM_FIELDS);
+ List<String> fields = request.paramAsStrings(Param.FIELDS);
String language = request.param(PARAM_LANGUAGE);
Map<String, Long> activeRuleCountByKey = profileLoader.countAllActiveRules();
Map<String, Long> projectCountByKey = qualityProfileDao.countProjectsByProfileKey();
-
json.name("profiles")
.beginArray();
for (QProfile profile : profiles) {
private static final String PARAM_LOGIN = "login";
private static final String PARAM_SELECTED = "selected";
- private static final String PARAM_QUERY = "q";
private static final String SELECTION_ALL = "all";
private static final String SELECTION_SELECTED = "selected";
.setPossibleValues(SELECTION_SELECTED, SELECTION_DESELECTED, SELECTION_ALL)
.setDefaultValue(SELECTION_ALL);
- action.createParam(PARAM_QUERY)
+ action.createParam(Param.TEXT_QUERY)
.setDescription("If specified, only show groups whose name contains the query.")
.setExampleValue("user");
String login = request.mandatoryParam(PARAM_LOGIN);
int pageSize = request.mandatoryParamAsInt(Param.PAGE_SIZE);
int page = request.mandatoryParamAsInt(Param.PAGE);
- String queryString = request.param(PARAM_QUERY);
+ String queryString = request.param(Param.TEXT_QUERY);
String selected = request.param(PARAM_SELECTED);
GroupMembershipQuery query = GroupMembershipQuery.builder()