private List<IssueService.IssueResult> simpleTravel( User user, Issue issue, Status to, MultiMap<String, Object, ? extends List> params, final List<IssueService.TransitionValidationResult> errorResults) { List<IssueService.IssueResult> resultList = new ArrayList<IssueService.IssueResult>(); User oldUser = jiraAuthenticationContext.getLoggedInUser(); jiraAuthenticationContext.setLoggedInUser(user); List<IssueService.TransitionValidationResult> validResults = getValidResults(user, issue, to, params, errorResults); if (!validResults.isEmpty()) { for (IssueService.TransitionValidationResult validResult : validResults) { IssueService.IssueResult result = issueService.transition(user, validResult); if (result.getErrorCollection() != null && result.getErrorCollection().hasAnyErrors()) { log.warn( "result of transition for issue : " + validResult.getIssue().getKey() + " and transition : " + to.getName() + " is not so valid, something wrong here : " + (result.getErrorCollection().getErrorMessages() != null ? Arrays.toString(result.getErrorCollection().getErrorMessages().toArray()) : " dunno what")); errorResults.add(validResult); } else { resultList.add(result); return resultList; } } // TODO: do something with multiple results } jiraAuthenticationContext.setLoggedInUser(oldUser); return resultList; }
@RequiresXsrfCheck protected String doExecute() throws Exception { if (invalidAction()) { return WorkflowUIDispatcher.INVALID_ACTION; } final IssueService.IssueResult transitionResult = issueService.transition(getRemoteUser(), this.transitionResult); if (!transitionResult.isValid()) { addErrorCollection(transitionResult.getErrorCollection()); return ERROR; } if (isInlineDialogMode()) { return returnComplete(); } return redirectToView(); }