diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-01-29 19:13:49 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-02-02 17:52:34 +0100 |
commit | a210c65f91fab1542d11f11a4156734a08deebc2 (patch) | |
tree | 086abf623dcdf9de742d991a132a5a2974f7940a /sonar-ws | |
parent | 6518e557baa37f599284ac92cd9ca02b76654fd9 (diff) | |
download | sonarqube-a210c65f91fab1542d11f11a4156734a08deebc2.tar.gz sonarqube-a210c65f91fab1542d11f11a4156734a08deebc2.zip |
SONAR-7152 WS api/qualitygates/project_status search by project id or key
Diffstat (limited to 'sonar-ws')
3 files changed, 69 insertions, 5 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/ProjectStatusWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/ProjectStatusWsRequest.java index e5bf09d8e3c..328efa5bb58 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/ProjectStatusWsRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/ProjectStatusWsRequest.java @@ -19,15 +19,41 @@ */ package org.sonarqube.ws.client.qualitygate; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + public class ProjectStatusWsRequest { - private String taskId; + private String analysisId; + private String projectId; + private String projectKey; + @CheckForNull public String getAnalysisId() { - return taskId; + return analysisId; + } + + public ProjectStatusWsRequest setAnalysisId(@Nullable String analysisId) { + this.analysisId = analysisId; + return this; + } + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public ProjectStatusWsRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; } - public ProjectStatusWsRequest setAnalysisId(String taskId) { - this.taskId = taskId; + public ProjectStatusWsRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; return this; } } 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 6142b9aa167..bd00874f57a 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 @@ -24,6 +24,10 @@ import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; 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_PROJECT_ID; +import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; + public class QualityGatesService extends BaseService { public QualityGatesService(WsConnector wsConnector) { @@ -32,7 +36,9 @@ public class QualityGatesService extends BaseService { public ProjectStatusWsResponse projectStatus(ProjectStatusWsRequest request) { return call(new GetRequest(path("project_status")) - .setParam("analysisId", request.getAnalysisId()), + .setParam(PARAM_ANALYSIS_ID, request.getAnalysisId()) + .setParam(PARAM_PROJECT_ID, request.getProjectId()) + .setParam(PARAM_PROJECT_KEY, request.getProjectKey()), ProjectStatusWsResponse.parser()); } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesWsParameters.java new file mode 100644 index 00000000000..5ba885b3dd3 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesWsParameters.java @@ -0,0 +1,32 @@ +/* + * 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; + +public class QualityGatesWsParameters { + public static final String PARAM_ANALYSIS_ID = "analysisId"; + public static final String PARAM_PROJECT_ID = "projectId"; + public static final String PARAM_PROJECT_KEY = "projectKey"; + + private QualityGatesWsParameters() { + // prevent instantiation + } + +} |