@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); }
/** Create manual issue */ public Result<DefaultIssue> create(Map<String, String> params) { Result<DefaultIssue> result = Result.of(); try { // mandatory parameters String componentKey = params.get("component"); if (StringUtils.isBlank(componentKey)) { result.addError("Component is not set"); } RuleKey ruleKey = null; String rule = params.get("rule"); if (StringUtils.isBlank(rule)) { result.addError(Result.Message.ofL10n("issue.manual.missing_rule")); } else { ruleKey = RuleKey.parse(rule); } if (result.ok()) { DefaultIssue issue = issueService.createManualIssue( componentKey, ruleKey, RubyUtils.toInteger(params.get("line")), params.get("message"), params.get("severity"), RubyUtils.toDouble(params.get("effortToFix")), UserSession.get()); result.set(issue); } } catch (Exception e) { result.addError(e.getMessage()); } return result; }
public Result<Issue> plan(String issueKey, @Nullable String actionPlanKey) { Result<Issue> result = Result.of(); try { result.set(issueService.plan(issueKey, actionPlanKey, UserSession.get())); } catch (Exception e) { result.addError(e.getMessage()); } return result; }
public Result<Issue> setSeverity(String issueKey, String severity) { Result<Issue> result = Result.of(); try { result.set(issueService.setSeverity(issueKey, severity, UserSession.get())); } catch (Exception e) { result.addError(e.getMessage()); } return result; }
public Result<Issue> doTransition(String issueKey, String transitionKey) { Result<Issue> result = Result.of(); try { result.set(issueService.doTransition(issueKey, transitionKey, UserSession.get())); } catch (Exception e) { result.addError(e.getMessage()); } return result; }
public void writeTransitions(Issue issue, JsonWriter json) { json.name("transitions").beginArray(); if (userSession.isLoggedIn()) { for (Transition transition : issueService.listTransitions(issue)) { json.value(transition.key()); } } json.endArray(); }
private void writeTransitions(Issue issue, JsonWriter json) { json.name("transitions").beginArray(); if (UserSession.get().isLoggedIn()) { List<Transition> transitions = issueService.listTransitions(issue, UserSession.get()); for (Transition transition : transitions) { json.value(transition.key()); } } json.endArray(); }
public Result<Issue> assign(String issueKey, @Nullable String assignee) { Result<Issue> result = Result.of(); try { result.set( issueService.assign( issueKey, StringUtils.defaultIfBlank(assignee, null), UserSession.get())); } catch (Exception e) { result.addError(e.getMessage()); } return result; }
public List<String> listStatus() { return issueService.listStatus(); }
public List<Transition> listTransitions(Issue issue) { return issueService.listTransitions(issue, UserSession.get()); }
public List<Transition> listTransitions(String issueKey) { return issueService.listTransitions(issueKey, UserSession.get()); }