]> source.dussan.org Git - sonarqube.git/commitdiff
Change maven like key in WS document
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 13 Jan 2016 17:18:05 +0000 (18:18 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 15 Jan 2016 14:01:57 +0000 (15:01 +0100)
23 files changed:
server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java
server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java
server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java
server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java
server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java
server/sonar-server/src/main/java/org/sonar/server/measure/ws/TimeMachineWs.java
server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/DeleteAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java
server/sonar-server/src/main/java/org/sonar/server/source/ws/HashAction.java
server/sonar-server/src/main/java/org/sonar/server/source/ws/LinesAction.java
server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java
server/sonar-server/src/main/java/org/sonar/server/ws/KeyExamples.java [new file with mode: 0644]

index 68e55c9b7866f8c97c1cf249baf7c65a1889d5c1..12cc4018c458b0b05528cb5fbf0d21b8fa1a933b 100644 (file)
@@ -41,6 +41,7 @@ import org.sonar.server.user.UserSession;
 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 {
 
@@ -71,7 +72,7 @@ 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
index 368b9b3dee5ee112865cd510b04be2889c8c0229..256c606cd03e4cfe636cb5723ec10d9f7e5dce31 100644 (file)
@@ -30,6 +30,7 @@ import org.sonar.batch.protocol.input.ProjectRepositories;
 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 {
@@ -57,7 +58,7 @@ 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)
index 8be341d5def21e5835f18ed3b21b50ecc6383262..f2ea2507ed218d5af51a095fd335e1af9ceb4803 100644 (file)
@@ -23,6 +23,8 @@ import com.google.common.io.Resources;
 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
@@ -47,7 +49,7 @@ public class ResourcesWs implements WebService {
 
     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>. " +
index db903ba291dcc42ae312600313960450ea4a424a..539255f0713caa2af591281491459ad9c7de9d6d 100644 (file)
@@ -42,6 +42,7 @@ import static java.lang.String.format;
 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;
@@ -81,7 +82,7 @@ public class ShowAction implements ComponentsWsAction {
 
     action.createParam(PARAM_KEY)
       .setDescription("Component key")
-      .setExampleValue("net.java.openjdk:jdk7");
+      .setExampleValue(KEY_PROJECT_EXAMPLE_001);
   }
 
   @Override
index b7661148f52ebd5e89e8d0b9bdae8697774b3498..a67d38a0bf4b60c5b29942607056e692d307f8fb 100644 (file)
@@ -50,6 +50,7 @@ import static java.lang.String.format;
 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;
@@ -112,7 +113,7 @@ public class TreeAction implements ComponentsWsAction {
 
     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));
 
index 7086a0aad57ff23f884a7da4ec3aeb126b32f283..89536c5e3addb76c1285731cdd934c7820d8e276 100644 (file)
@@ -23,6 +23,8 @@ import com.google.common.io.Resources;
 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
@@ -135,7 +137,7 @@ public class ActionPlanWs implements WebService {
   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);
   }
 
index 718224065e37b4c131e6162fc0cc51f965ae0696..1ef04aa330d6d00b5f108956c94932056b4aa073 100644 (file)
@@ -27,6 +27,8 @@ import org.sonar.api.server.ws.WebService;
 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";
@@ -50,7 +52,7 @@ public class CreateAction implements IssuesWsAction {
     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)
index 2e5be76149aa62a30cf0e41785a7683d0cfbbb99..5d8d9a2c3f3440df6e55b3818796c4364369b214 100644 (file)
@@ -55,6 +55,7 @@ import static com.google.common.collect.Iterables.concat;
 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;
@@ -208,7 +209,7 @@ public class SearchAction implements IssuesWsAction {
       .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.");
@@ -234,7 +235,7 @@ public class SearchAction implements IssuesWsAction {
         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 +
index 1bbf3b696da81341ffcca74ed14d5f77f21354ec..dcf8ca7a28adc108aa7764d2806378141229b670 100644 (file)
@@ -41,6 +41,7 @@ import static com.google.common.base.Preconditions.checkArgument;
 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";
@@ -86,7 +87,7 @@ public class CreateAction implements CustomMeasuresWsAction {
 
     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")
index 37af94449ab7b19561c36e22ffe2b0d9a9daa13d..ff601f7adc55c37a441406ce47224c9d64acd9ab 100644 (file)
@@ -36,6 +36,7 @@ import org.sonar.server.user.UserSession;
 
 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";
@@ -69,7 +70,7 @@ public class MetricsAction implements CustomMeasuresWsAction {
 
     action.createParam(PARAM_PROJECT_KEY)
       .setDescription("Project key")
-      .setExampleValue("org.apache.hbas:hbase");
+      .setExampleValue(KEY_PROJECT_EXAMPLE_001);
   }
 
   @Override
index 7b1e5a41838b91e6530137071f6cdd93cc4d6be4..3820a4ddc05d02ac75870225a7e8f6be0b4847b8 100644 (file)
@@ -49,6 +49,7 @@ import static com.google.common.collect.Sets.newHashSet;
 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 {
 
@@ -87,7 +88,7 @@ public class SearchAction implements CustomMeasuresWsAction {
 
     action.createParam(PARAM_PROJECT_KEY)
       .setDescription("Project key")
-      .setExampleValue("org.apache.hbas:hbase");
+      .setExampleValue(KEY_PROJECT_EXAMPLE_001);
   }
 
   @Override
index 77d88aca13199e144ce23e4292c6e029ea5e3e23..8ff8bc13e08b92eb0b5295ee39985d366ad3b282 100644 (file)
@@ -39,6 +39,7 @@ import static java.lang.String.format;
 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;
@@ -114,7 +115,7 @@ public class ComponentTreeAction implements MeasuresWsAction {
 
     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")
index a31bd6df5eabcc86fc7a7a581156258dddedadd2..11b1096da85f657dd9644df7dab0e6ef2d7842c1 100644 (file)
@@ -23,6 +23,8 @@ import com.google.common.io.Resources;
 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
@@ -46,7 +48,7 @@ public class TimeMachineWs implements WebService {
     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>")
index f93f685ce98134e8add18467f2daafaa2ed3e240..78a2dbf1ab3bcedf694e3eca3f908af45fe76ed2 100644 (file)
@@ -25,6 +25,7 @@ import org.sonar.core.permission.ProjectPermissions;
 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;
@@ -94,7 +95,7 @@ public class PermissionsWsParametersBuilder {
   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) {
index cd5dfa7c66559438d9fcbfc57bcb67f74b26aa8a..a90df5423512a334e339fa5a01439e7abb7f0a6e 100644 (file)
@@ -32,6 +32,8 @@ import org.sonar.db.component.ComponentDto;
 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";
 
@@ -65,7 +67,7 @@ public class BulkDeleteAction implements ProjectsWsAction {
     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
index 431db1d3adc735ae7a1922bb1b9827c136d6df86..7c7dd96e1626addf5f024255b6329ae696c85243 100644 (file)
@@ -35,6 +35,7 @@ import org.sonar.server.component.ComponentFinder;
 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";
@@ -71,7 +72,7 @@ public class DeleteAction implements ProjectsWsAction {
     action
       .createParam(PARAM_KEY)
       .setDescription("Project key")
-      .setExampleValue("org.apache.hbas:hbase");
+      .setExampleValue(KEY_PROJECT_EXAMPLE_001);
   }
 
   @Override
index ca1b86e4c54bfe32b41d93af0ad4c4b38756603b..038b2f28783eff37ca99614c750af8f1e45808d2 100644 (file)
@@ -23,6 +23,8 @@ import com.google.common.io.Resources;
 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";
@@ -59,7 +61,7 @@ public class ProjectsWs implements WebService {
 
     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")
@@ -104,7 +106,7 @@ public class ProjectsWs implements WebService {
     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")
index e67383244745339c9f73dd49a2a69f77247ad562..634c6a4c714e668c5c2a4ef4203c1f0db0540f41 100644 (file)
@@ -23,6 +23,8 @@ import com.google.common.io.Resources;
 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}
@@ -83,7 +85,7 @@ public class ProfilesWs implements WebService {
       .setExampleValue("java");
     action.createParam("project")
       .setDescription("Project key or id")
-      .setExampleValue("org.codehaus.sonar:sonar");
+      .setExampleValue(KEY_PROJECT_EXAMPLE_001);
     RailsHandler.addJsonOnlyFormatParam(action);
   }
 }
index ea4b18b25ec8409ef6c840c4954b925e9a68a3d4..896907eba3eebc18bfd9b88d4ffdbd6db202abdd 100644 (file)
@@ -36,6 +36,7 @@ import org.sonar.server.qualityprofile.QProfileProjectOperations;
 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 {
@@ -92,7 +93,7 @@ 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");
index f8afd3d76a56b1797617a8b24d3acf6e1b210cfc..bf1fcecac581cd0e1127056a4c9289b4712aa603 100644 (file)
@@ -36,6 +36,8 @@ import org.sonar.db.component.ComponentDto;
 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;
@@ -61,7 +63,7 @@ public class HashAction implements SourcesWsAction {
       .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
index 73167b0e14f0639c5096ea0c8a895e3e06d8cc94..6eca54879350e38273092d643b339e76e9bccabf 100644 (file)
@@ -40,6 +40,7 @@ import org.sonar.server.source.SourceService;
 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 {
 
@@ -94,7 +95,7 @@ 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)
index 9cc51887bb7f6a204b5beaf74683298c0ea4078f..6880edf560546d5800d11b2176f38bdca391d2f9 100644 (file)
@@ -55,6 +55,8 @@ import org.sonar.server.ui.ViewProxy;
 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";
@@ -99,8 +101,7 @@ public class ComponentNavigationAction implements NavigationWsAction {
 
     projectNavigation.createParam(PARAM_COMPONENT_KEY)
       .setDescription("A component key.")
-      .setExampleValue("org.codehaus.sonar:sonar")
-      .setRequired(true);
+      .setExampleValue(KEY_PROJECT_EXAMPLE_001);
   }
 
   @Override
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ws/KeyExamples.java b/server/sonar-server/src/main/java/org/sonar/server/ws/KeyExamples.java
new file mode 100644 (file)
index 0000000..4f57cc6
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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
+  }
+}