@SuppressWarnings("unchecked") @Override public ErrorCollection setScreen(@Nonnull String transitionName, @Nullable FieldScreen screen, @Nonnull JiraWorkflow workflow) { ErrorCollection errorCollection = checkArguments(transitionName, workflow); if (errorCollection.hasAnyErrors()) { return errorCollection; } Option<JiraWorkflow> getDraft = draftOf(errorCollection, workflow); if (getDraft.isEmpty()) { return errorCollection; } JiraWorkflow draftWorkflow = getDraft.get(); Either<Collection<ActionDescriptor>, ErrorCollection> getActions = getActionsByName(transitionName, draftWorkflow); if (getActions.isRight()) { return getActions.right().get(); } for (ActionDescriptor action : getActions.left().get()) { setActionScreen(action, screen); } workflowService.updateWorkflow(getServiceContext(errorCollection), draftWorkflow); return errorCollection; }
@RequiresXsrfCheck protected String doExecute() throws Exception { // setup the transition action action.setName(getTransitionName()); action.getMetaAttributes().put(JiraWorkflow.WORKFLOW_DESCRIPTION_ATTRIBUTE, getDescription()); setActionScreen(action, stringSet(getView()) ? getFieldScreen() : null); // setup the destination step result ResultDescriptor result = action.getUnconditionalResult(); result.setStep(getDestinationStep()); workflowService.updateWorkflow(getJiraServiceContext(), getWorkflow()); return getRedirect(getCancelUrl()); }
@RequiresXsrfCheck protected String doExecute() throws Exception { // setup the transition action ActionDescriptor action = DescriptorFactory.getFactory().createActionDescriptor(); action.setId(getWorkflow().getNextActionId()); action.setName(getTransitionName()); action.getMetaAttributes().put(JiraWorkflow.WORKFLOW_DESCRIPTION_ATTRIBUTE, getDescription()); setActionScreen(action, stringSet(getView()) ? getFieldScreen() : null); // setup the result ResultDescriptor result = DescriptorFactory.getFactory().createResultDescriptor(); action.setUnconditionalResult(result); result.setStep(getDestinationStep()); result.setOldStatus("Not Done"); result.setStatus("Done"); initialiseTransition(action); action.setParent(getStep()); getStep().getActions().add(action); workflowService.updateWorkflow(getJiraServiceContext(), getWorkflow()); return getRedirect(getCancelUrl()); }