diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-11-12 12:02:42 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-11-17 13:41:00 +0100 |
commit | 31f6f53074997281db532ebc75bf5006929e9c6a (patch) | |
tree | 8757412857b12f08843b2b5f6396e64768a62c0c /sonar-ws | |
parent | 50f694232ddc2f21f3a9e9d91b5662e489c955cf (diff) | |
download | sonarqube-31f6f53074997281db532ebc75bf5006929e9c6a.tar.gz sonarqube-31f6f53074997281db532ebc75bf5006929e9c6a.zip |
SONAR-6947 Create and use ApplyTemplateWsRequest
Diffstat (limited to 'sonar-ws')
-rw-r--r-- | sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateWsRequest.java | 71 | ||||
-rw-r--r-- | sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java | 8 |
2 files changed, 79 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateWsRequest.java new file mode 100644 index 00000000000..6201872414e --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/ApplyTemplateWsRequest.java @@ -0,0 +1,71 @@ +/* + * 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.permission; + +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +public class ApplyTemplateWsRequest { + private String projectId; + private String projectKey; + private String templateId; + private String templateName; + + @CheckForNull + public String getProjectId() { + return projectId; + } + + public ApplyTemplateWsRequest setProjectId(@Nullable String projectId) { + this.projectId = projectId; + return this; + } + + @CheckForNull + public String getProjectKey() { + return projectKey; + } + + public ApplyTemplateWsRequest setProjectKey(@Nullable String projectKey) { + this.projectKey = projectKey; + return this; + } + + @CheckForNull + public String getTemplateId() { + return templateId; + } + + public ApplyTemplateWsRequest setTemplateId(@Nullable String templateId) { + this.templateId = templateId; + return this; + } + + @CheckForNull + public String getTemplateName() { + return templateName; + } + + public ApplyTemplateWsRequest setTemplateName(@Nullable String templateName) { + this.templateName = templateName; + return this; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java index ba75a5cef85..40da04c5800 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/permission/PermissionsWsClient.java @@ -87,6 +87,14 @@ public class PermissionsWsClient { .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); } + public void applyTemplate(ApplyTemplateWsRequest request) { + wsClient.execute(newPostRequest(action("apply_template")) + .setParam(PARAM_PROJECT_ID, request.getProjectId()) + .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) + .setParam(PARAM_TEMPLATE_ID, request.getTemplateId()) + .setParam(PARAM_TEMPLATE_NAME, request.getTemplateName())); + } + private static String action(String action) { return PermissionsWsParameters.ENDPOINT + "/" + action; } |