diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-07-29 17:41:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-29 17:41:48 +0200 |
commit | 7b93c4de175621ce43236126a4a239534bed229e (patch) | |
tree | 25d9743ec3e0610a24bd877ee878e50a2386e2cc /sonar-ws/src/main | |
parent | f6f754fc4a291b18ea4c9d183b7a2bfecbe1e2e3 (diff) | |
download | sonarqube-7b93c4de175621ce43236126a4a239534bed229e.tar.gz sonarqube-7b93c4de175621ce43236126a4a239534bed229e.zip |
SONAR-7924 Modify WS api/qualitygates/select to accept project key (#1126)
Diffstat (limited to 'sonar-ws/src/main')
-rw-r--r-- | sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesService.java | 9 | ||||
-rw-r--r-- | sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/SelectWsRequest.java | 57 |
2 files changed, 66 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesService.java index bd00874f57a..fa8a57ab4b9 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesService.java @@ -22,9 +22,11 @@ package org.sonarqube.ws.client.qualitygate; import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsConnector; import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID; +import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID; import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID; import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; @@ -41,4 +43,11 @@ public class QualityGatesService extends BaseService { .setParam(PARAM_PROJECT_KEY, request.getProjectKey()), ProjectStatusWsResponse.parser()); } + + public void associateProject(SelectWsRequest request) { + call(new PostRequest(path("select")) + .setParam(PARAM_GATE_ID, request.getGateId()) + .setParam(PARAM_PROJECT_ID, request.getProjectId()) + .setParam(PARAM_PROJECT_KEY, request.getProjectKey())); + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/SelectWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/SelectWsRequest.java new file mode 100644 index 00000000000..a3dc530f7b7 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/SelectWsRequest.java @@ -0,0 +1,57 @@ +/* + * 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.sonarqube.ws.client.qualitygate; + +import javax.annotation.CheckForNull; + +public class SelectWsRequest { + private long gateId; + private Long projectId; + private String projectKey; + + public long getGateId() { + return gateId; + } + + public SelectWsRequest setGateId(long gateId) { + this.gateId = gateId; + return this; + } + + @CheckForNull + public Long getProjectId() { + return projectId; + } + + public SelectWsRequest setProjectId(Long projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public SelectWsRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } +} |