aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-13 15:06:10 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-11-17 13:41:04 +0100
commit0444203efdb03f630a7912bc62bab892cbd9bbdc (patch)
treee2caa558a23b2bf62d87f051af459ea54421df91 /sonar-ws
parent40cf347e9aa2ded35a8798b8aec0abbf2e993183 (diff)
downloadsonarqube-0444203efdb03f630a7912bc62bab892cbd9bbdc.tar.gz
sonarqube-0444203efdb03f630a7912bc62bab892cbd9bbdc.zip
SONAR-6947 api/qualityprofiles/search use SearchWsRequest
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesWsClient.java44
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchWsRequest.java70
-rw-r--r--sonar-ws/src/main/protobuf/ws-qualityprofiles.proto2
3 files changed, 115 insertions, 1 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesWsClient.java
new file mode 100644
index 00000000000..2adb7528af2
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/QualityProfilesWsClient.java
@@ -0,0 +1,44 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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;
+
+import org.sonarqube.ws.QualityProfiles.SearchWsResponse;
+import org.sonarqube.ws.client.WsClient;
+
+import static org.sonarqube.ws.client.WsRequest.newGetRequest;
+
+public class QualityProfilesWsClient {
+ private final WsClient wsClient;
+
+ public QualityProfilesWsClient(WsClient wsClient) {
+ this.wsClient = wsClient;
+ }
+
+ public SearchWsResponse search(SearchWsRequest request) {
+ return wsClient.execute(
+ newGetRequest("search")
+ .setParam("defaults", request.getDefaults())
+ .setParam("language", request.getLanguage())
+ .setParam("profileName", request.getProfileName())
+ .setParam("projectKey", request.getProjectKey()),
+ SearchWsResponse.parser());
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchWsRequest.java
new file mode 100644
index 00000000000..60df4b4eff2
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualityprofile/SearchWsRequest.java
@@ -0,0 +1,70 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+
+public class SearchWsRequest {
+ private boolean defaults;
+ private String language;
+ private String profileName;
+ private String projectKey;
+
+ public boolean getDefaults() {
+ return defaults;
+ }
+
+ public SearchWsRequest setDefaults(boolean defaults) {
+ this.defaults = defaults;
+ return this;
+ }
+
+ @CheckForNull
+ public String getLanguage() {
+ return language;
+ }
+
+ public SearchWsRequest setLanguage(@Nullable String language) {
+ this.language = language;
+ return this;
+ }
+
+ @CheckForNull
+ public String getProfileName() {
+ return profileName;
+ }
+
+ public SearchWsRequest setProfileName(@Nullable String profileName) {
+ this.profileName = profileName;
+ return this;
+ }
+
+ @CheckForNull
+ public String getProjectKey() {
+ return projectKey;
+ }
+
+ public SearchWsRequest setProjectKey(@Nullable String projectKey) {
+ this.projectKey = projectKey;
+ return this;
+ }
+}
diff --git a/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto b/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto
index 25dd11c94fe..7ec0752759a 100644
--- a/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto
+++ b/sonar-ws/src/main/protobuf/ws-qualityprofiles.proto
@@ -25,7 +25,7 @@ option java_outer_classname = "QualityProfiles";
option optimize_for = SPEED;
// WS api/qualityprofiles/search
-message WsSearchResponse {
+message SearchWsResponse {
repeated QualityProfile profiles = 1;
message QualityProfile {