From: Teryk Bellahsene Date: Wed, 13 Jan 2016 17:18:05 +0000 (+0100) Subject: Change maven like key in WS document X-Git-Tag: 5.4-M8~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a3f1196a670cabc2980b8a0f63a5bb81d9ebdff3;p=sonarqube.git Change maven like key in WS document --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java b/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java index 68e55c9b786..12cc4018c45 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java index 368b9b3dee5..256c606cd03 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectAction.java @@ -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) diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java index 8be341d5def..f2ea2507ed2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java @@ -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 metric keys/ids. " + diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java index db903ba291d..539255f0713 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java index b7661148f52..a67d38a0bf4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java @@ -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)); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java b/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java index 7086a0aad57..89536c5e3ad 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/actionplan/ActionPlanWs.java @@ -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); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java index 718224065e3..1ef04aa330d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/CreateAction.java @@ -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) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java index 2e5be76149a..5d8d9a2c3f3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java @@ -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 + diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java index 1bbf3b696da..dcf8ca7a28a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java @@ -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") diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java index 37af94449ab..ff601f7adc5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/MetricsAction.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/SearchAction.java index 7b1e5a41838..3820a4ddc05 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/SearchAction.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java index 77d88aca131..8ff8bc13e08 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java @@ -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") diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/TimeMachineWs.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/TimeMachineWs.java index a31bd6df5ea..11b1096da85 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/TimeMachineWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/TimeMachineWs.java @@ -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 metric keys/ids") diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java index f93f685ce98..78a2dbf1ab3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/PermissionsWsParametersBuilder.java @@ -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) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java index cd5dfa7c665..a90df542351 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/DeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/DeleteAction.java index 431db1d3adc..7c7dd96e162 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/DeleteAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/DeleteAction.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java index ca1b86e4c54..038b2f28783 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWs.java @@ -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") diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java index e6738324474..634c6a4c714 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java @@ -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); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java index ea4b18b25ec..896907eba3e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProjectAssociationActions.java @@ -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"); diff --git a/server/sonar-server/src/main/java/org/sonar/server/source/ws/HashAction.java b/server/sonar-server/src/main/java/org/sonar/server/source/ws/HashAction.java index f8afd3d76a5..bf1fcecac58 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/source/ws/HashAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/source/ws/HashAction.java @@ -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 diff --git a/server/sonar-server/src/main/java/org/sonar/server/source/ws/LinesAction.java b/server/sonar-server/src/main/java/org/sonar/server/source/ws/LinesAction.java index 73167b0e14f..6eca5487935 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/source/ws/LinesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/source/ws/LinesAction.java @@ -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) diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java b/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java index 9cc51887bb7..6880edf5605 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java @@ -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 index 00000000000..4f57cc635b9 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/ws/KeyExamples.java @@ -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 + } +}