
org.sonar.server.issue.ws.DoTransitionAction Maven / Gradle / Ivy
/*
* 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.sonar.server.issue.ws;
import org.sonar.api.issue.DefaultTransitions;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.server.issue.IssueService;
public class DoTransitionAction implements IssuesWsAction {
public static final String ACTION = "do_transition";
private final IssueService issueService;
private final OperationResponseWriter responseWriter;
public DoTransitionAction(IssueService issueService, OperationResponseWriter responseWriter) {
this.issueService = issueService;
this.responseWriter = responseWriter;
}
@Override
public void define(WebService.NewController controller) {
WebService.NewAction action = controller.createAction(ACTION)
.setDescription("Do workflow transition on an issue. Requires authentication and Browse permission on project.
" +
"The transitions '" + DefaultTransitions.WONT_FIX + "' and '" + DefaultTransitions.FALSE_POSITIVE + "' require the permission 'Administer Issues'.")
.setSince("3.6")
.setHandler(this)
.setPost(true);
action.createParam("issue")
.setDescription("Key of the issue")
.setRequired(true)
.setExampleValue("5bccd6e8-f525-43a2-8d76-fcb13dde79ef");
action.createParam("transition")
.setDescription("Transition")
.setRequired(true)
.setPossibleValues(DefaultTransitions.ALL);
}
@Override
public void handle(Request request, Response response) throws Exception {
String key = request.mandatoryParam("issue");
issueService.doTransition(key, request.mandatoryParam("transition"));
responseWriter.write(key, request, response);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy