diff options
author | Daniel Schwarz <daniel.schwarz@sonarsource.com> | 2017-10-02 16:03:03 +0200 |
---|---|---|
committer | Daniel Schwarz <bartfastiel@users.noreply.github.com> | 2017-10-04 13:32:03 +0200 |
commit | 489831d3073f67cb838fd607fa90a344125c33f2 (patch) | |
tree | 8ed64167a6e586e4510abdd248ced4d3793a664c /sonar-ws | |
parent | ec5005ad979eb7bc47f277b42992851d8a4fbebc (diff) | |
download | sonarqube-489831d3073f67cb838fd607fa90a344125c33f2.tar.gz sonarqube-489831d3073f67cb838fd607fa90a344125c33f2.zip |
SONAR-9498 show correct n. of "more" items in quality profile changelog
Diffstat (limited to 'sonar-ws')
2 files changed, 149 insertions, 4 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogWsRequest.java new file mode 100644 index 00000000000..d47024682a9 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/ChangelogWsRequest.java @@ -0,0 +1,126 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info 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.sonarqube.ws.client.qualityprofile; + +public class ChangelogWsRequest { + + private final String language; + private final String organization; + private final Integer p; + private final Integer ps; + private final String qualityProfile; + private final String since; + private final String to; + + private ChangelogWsRequest(Builder builder) { + this.language = builder.language; + this.organization = builder.organization; + this.p = builder.p; + this.ps = builder.ps; + this.qualityProfile = builder.qualityProfile; + this.since = builder.since; + this.to = builder.to; + } + + public String getLanguage() { + return language; + } + + public String getOrganization() { + return organization; + } + + public Integer getP() { + return p; + } + + public Integer getPs() { + return ps; + } + + public String getQualityProfile() { + return qualityProfile; + } + + public String getSince() { + return since; + } + + public String getTo() { + return to; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String language; + private String organization; + private Integer p; + private Integer ps; + private String qualityProfile; + private String since; + private String to; + + private Builder() { + } + + public Builder setLanguage(String language) { + this.language = language; + return this; + } + + public Builder setOrganization(String organization) { + this.organization = organization; + return this; + } + + public Builder setP(Integer p) { + this.p = p; + return this; + } + + public Builder setPs(Integer ps) { + this.ps = ps; + return this; + } + + public Builder setQualityProfile(String qualityProfile) { + this.qualityProfile = qualityProfile; + return this; + } + + public Builder setSince(String since) { + this.since = since; + return this; + } + + public Builder setTo(String to) { + this.to = to; + return this; + } + + public ChangelogWsRequest build() { + return new ChangelogWsRequest(this); + } + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java index fe2a4171b73..2364a1dae50 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesService.java @@ -59,15 +59,14 @@ import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters. import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_DEFAULTS; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_FROM_KEY; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_GROUP; +import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LANGUAGE; -import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_NAME; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_LOGIN; +import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_NAME; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_ORGANIZATION; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARAMS; -import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_KEY; -import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_KEY; -import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE; +import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PARENT_QUALITY_PROFILE; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_KEY; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_PROJECT_UUID; import static org.sonarqube.ws.client.qualityprofile.QualityProfileWsParameters.PARAM_QUALITY_PROFILE; @@ -243,4 +242,24 @@ public class QualityProfilesService extends BaseService { .setParam(PAGE_SIZE, request.getPageSize()), SearchGroupsResponse.parser()); } + + public String changelog(ChangelogWsRequest request) { + PostRequest postRequest = new PostRequest(path("changelog")) + .setParam("language", request.getLanguage()) + .setParam("organization", request.getOrganization()) + .setParam("qualityProfile", request.getQualityProfile()); + if (request.getP() != null) { + postRequest.setParam("p", request.getP()); + } + if (request.getPs() != null) { + postRequest.setParam("ps", request.getPs()); + } + if (request.getSince() != null) { + postRequest.setParam("since", request.getSince()); + } + if (request.getTo() != null) { + postRequest.setParam("to", request.getTo()); + } + return call(postRequest).content(); + } } |