import org.sonarqube.ws.MediaTypes;
import static com.google.common.collect.Maps.newHashMap;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
public class IssuesAction implements BatchWsAction {
.createParam(PARAM_KEY)
.setRequired(true)
.setDescription("Project, module or file key")
- .setExampleValue("org.codehaus.sonar:sonar");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
}
@Override
import org.sonarqube.ws.WsBatch.WsProjectResponse;
import org.sonarqube.ws.WsBatch.WsProjectResponse.FileData.Builder;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
public class ProjectAction implements BatchWsAction {
.createParam(PARAM_KEY)
.setRequired(true)
.setDescription("Project or module key")
- .setExampleValue("org.codehaus.sonar:sonar");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action
.createParam(PARAM_PROFILE)
import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+
public class ResourcesWs implements WebService {
@Override
action.createParam("resource")
.setDescription("id or key of the resource")
- .setExampleValue("org.codehaus.sonar:sonar");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam("metrics")
.setDescription("Comma-separated list of <a href=\"http://redirect.sonarsource.com/doc/metric-definitions.html\">metric keys/ids</a>. " +
import static java.util.Collections.emptyList;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SHOW;
import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ID;
action.createParam(PARAM_KEY)
.setDescription("Component key")
- .setExampleValue("net.java.openjdk:jdk7");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
}
@Override
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_02;
import static org.sonar.server.component.ComponentFinder.ParamNames.BASE_COMPONENT_ID_AND_KEY;
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsParameterBuilder.QualifierParameterContext.newQualifierParameterContext;
import static org.sonar.server.ws.WsParameterBuilder.createQualifiersParameter;
import static org.sonar.server.ws.WsUtils.checkRequest;
action.createParam(PARAM_BASE_COMPONENT_KEY)
.setDescription("Base component key.The search is based on this component. It is not included in the response.")
- .setExampleValue("org.apache.hbas:hbase");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
createQualifiersParameter(action, newQualifierParameterContext(userSession, i18n, resourceTypes));
import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+
public class ActionPlanWs implements WebService {
@Override
private static NewParam addProjectParam(WebService.NewAction action) {
return action.createParam("project")
.setDescription("Project key")
- .setExampleValue("org.codehaus.sonar:sonar")
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001)
.setRequired(true);
}
import org.sonar.core.issue.DefaultIssue;
import org.sonar.server.issue.IssueService;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+
public class CreateAction implements IssuesWsAction {
public static final String ACTION = "create";
action.createParam("component")
.setDescription("Key of the component on which to log the issue")
.setRequired(true)
- .setExampleValue("org.apache.struts:struts:org.apache.struts.Action");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam("rule")
.setDescription("Manual rule key")
.setRequired(true)
import static java.util.Collections.singletonList;
import static org.sonar.api.utils.Paging.forPageIndex;
import static org.sonar.server.es.SearchOptions.MAX_LIMIT;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.ACTION_PLANS;
import static org.sonarqube.ws.client.issue.IssueFilterParameters.ADDITIONAL_FIELDS;
.setDescription("To retrieve issues associated to a specific list of components sub-components (comma-separated list of component keys). " +
"A component can be a view, developer, project, module, directory or file. " +
"If this parameter is set, componentUuids must not be set.")
- .setExampleValue("org.apache.struts:struts:org.apache.struts.Action");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam(IssueFilterParameters.COMPONENTS)
.setDeprecatedSince("5.1")
.setDescription("If used, will have the same meaning as componentKeys AND onComponentOnly=true.");
INTERNAL_PARAMETER_DISCLAIMER +
"If this parameter is set, projectUuids must not be set.")
.setDeprecatedKey(IssueFilterParameters.PROJECTS)
- .setExampleValue("org.apache.struts:struts:org.apache.struts.Action");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam(IssueFilterParameters.PROJECT_UUIDS)
.setDescription("To retrieve issues associated to a specific list of projects (comma-separated list of project UUIDs). " +
INTERNAL_PARAMETER_DISCLAIMER +
import static org.sonar.server.component.ComponentFinder.ParamNames.PROJECT_ID_AND_KEY;
import static org.sonar.server.measure.custom.ws.CustomMeasureValidator.checkPermissions;
import static org.sonar.server.measure.custom.ws.CustomMeasureValueDescription.measureValueDescription;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
public class CreateAction implements CustomMeasuresWsAction {
public static final String ACTION = "create";
action.createParam(PARAM_PROJECT_KEY)
.setDescription("Project key")
- .setExampleValue("org.apache.hbas:hbase");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam(PARAM_METRIC_ID)
.setDescription("Metric id")
import static org.sonar.server.component.ComponentFinder.ParamNames.PROJECT_ID_AND_KEY;
import static org.sonar.server.measure.custom.ws.CustomMeasureValidator.checkPermissions;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
public class MetricsAction implements CustomMeasuresWsAction {
public static final String ACTION = "metrics";
action.createParam(PARAM_PROJECT_KEY)
.setDescription("Project key")
- .setExampleValue("org.apache.hbas:hbase");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
}
@Override
import static org.sonar.server.component.ComponentFinder.ParamNames.PROJECT_ID_AND_KEY;
import static org.sonar.server.es.SearchOptions.MAX_LIMIT;
import static org.sonar.server.measure.custom.ws.CustomMeasureValidator.checkPermissions;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
public class SearchAction implements CustomMeasuresWsAction {
action.createParam(PARAM_PROJECT_KEY)
.setDescription("Project key")
- .setExampleValue("org.apache.hbas:hbase");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
}
@Override
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_02;
import static org.sonar.server.measure.ws.ComponentDtoToWsComponent.componentDtoToWsComponent;
import static org.sonar.server.measure.ws.MetricDtoToWsMetric.metricDtoToWsMetric;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsParameterBuilder.QualifierParameterContext.newQualifierParameterContext;
import static org.sonar.server.ws.WsParameterBuilder.createQualifiersParameter;
import static org.sonar.server.ws.WsUtils.checkRequest;
action.createParam(PARAM_BASE_COMPONENT_KEY)
.setDescription("Base component key.The search is based on this component.")
- .setExampleValue("org.apache.hbas:hbase");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam(PARAM_METRIC_KEYS)
.setDescription("Metric keys")
import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+
public class TimeMachineWs implements WebService {
@Override
action.createParam("resource")
.setDescription("id or key of the resource (ie: component)")
.setRequired(true)
- .setExampleValue("org.codehaus.sonar:sonar");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam("metrics")
.setDescription("Comma-separated list of <a href=\"http://redirect.sonarsource.com/doc/metric-definitions.html\">metric keys/ids</a>")
import org.sonar.core.util.Uuids;
import static java.lang.String.format;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_DESCRIPTION;
import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_ID;
import static org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_GROUP_NAME;
private static void createProjectKeyParameter(NewAction action) {
action.createParam(PARAM_PROJECT_KEY)
.setDescription("Project key")
- .setExampleValue("org.apache.hbas:hbase");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
}
public static void createUserLoginParameter(NewAction action) {
import org.sonar.server.component.ComponentCleanerService;
import org.sonar.server.user.UserSession;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+
public class BulkDeleteAction implements ProjectsWsAction {
private static final String ACTION = "bulk_delete";
action
.createParam(PARAM_KEYS)
.setDescription("List of project keys to delete")
- .setExampleValue("org.apache.hbas:hbase,com.microsoft.roslyn:roslyn");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
}
@Override
import org.sonar.server.user.UserSession;
import static org.sonar.server.component.ComponentFinder.ParamNames.ID_AND_KEY;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
public class DeleteAction implements ProjectsWsAction {
private static final String ACTION = "delete";
action
.createParam(PARAM_KEY)
.setDescription("Project key")
- .setExampleValue("org.apache.hbas:hbase");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
}
@Override
import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+
public class ProjectsWs implements WebService {
public static final String ENDPOINT = "api/projects";
private static final String FALSE = "false";
action.createParam("key")
.setDescription("id or key of the project")
- .setExampleValue("org.codehaus.sonar:sonar");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam("search")
.setDescription("Substring of project name, case insensitive")
action.createParam("key")
.setDescription("Key of the project")
.setRequired(true)
- .setExampleValue("org.codehaus.sonar:sonar");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam("name")
.setDescription("Name of the project")
import org.sonar.api.server.ws.RailsHandler;
import org.sonar.api.server.ws.WebService;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+
/**
* List of quality profiles WS implemented in Rails.
* New WS on quality profiles MUST be declared in {@link org.sonar.server.qualityprofile.ws.QProfilesWs}
.setExampleValue("java");
action.createParam("project")
.setDescription("Project key or id")
- .setExampleValue("org.codehaus.sonar:sonar");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
RailsHandler.addJsonOnlyFormatParam(action);
}
}
import org.sonar.server.user.UserSession;
import static org.apache.commons.lang.StringUtils.isEmpty;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
@ServerSide
public class ProjectAssociationActions {
.setExampleValue("69e57151-be0d-4157-adff-c06741d88879");
action.createParam(PARAM_PROJECT_KEY)
.setDescription("A project key. Either this parameter, or projectUuid must be set.")
- .setExampleValue("org.codehaus.sonar:sonar");
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
action.createParam(PARAM_PROFILE_KEY)
.setDescription("A quality profile key. Either this parameter, or a combination of profileName + language must be set.")
.setExampleValue("sonar-way-java-12345");
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
+import static org.sonar.server.ws.KeyExamples.KEY_FILE_EXAMPLE_001;
+
public class HashAction implements SourcesWsAction {
private final DbClient dbClient;
.createParam("key")
.setRequired(true)
.setDescription("File key")
- .setExampleValue("org.codehaus.sonar:sonar-server:src/main/java/org/sonar/server/source/SourceService.java");
+ .setExampleValue(KEY_FILE_EXAMPLE_001);
}
@Override
import org.sonar.server.user.UserSession;
import static org.sonar.server.component.ComponentFinder.ParamNames.UUID_AND_KEY;
+import static org.sonar.server.ws.KeyExamples.KEY_FILE_EXAMPLE_001;
public class LinesAction implements SourcesWsAction {
action
.createParam(PARAM_KEY)
.setDescription("File key. Mandatory if param 'uuid' is not set. Available since 5.2")
- .setExampleValue("org.sample:src/main/java/Foo.java");
+ .setExampleValue(KEY_FILE_EXAMPLE_001);
action
.createParam(PARAM_FROM)
import org.sonar.server.ui.Views;
import org.sonar.server.user.UserSession;
+import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
+
public class ComponentNavigationAction implements NavigationWsAction {
private static final String PARAM_COMPONENT_KEY = "componentKey";
projectNavigation.createParam(PARAM_COMPONENT_KEY)
.setDescription("A component key.")
- .setExampleValue("org.codehaus.sonar:sonar")
- .setRequired(true);
+ .setExampleValue(KEY_PROJECT_EXAMPLE_001);
}
@Override
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.ws;
+
+public class KeyExamples {
+ public static final String KEY_FILE_EXAMPLE_001 = "my_project:/src/foo/Bar.php";
+ public static final String KEY_PROJECT_EXAMPLE_001 = "my_project";
+
+ private KeyExamples() {
+ // prevent instantiation
+ }
+}