public JiraWorkflow copyWorkflow(ApplicationUser user, String clonedWorkflowName, String clonedWorkflowDescription, JiraWorkflow workflowToClone) { final WorkflowDescriptor workflowDescriptor; try { workflowDescriptor = cloneDescriptor(workflowToClone.getDescriptor()); } catch (FactoryException e) { throw new WorkflowException("Unexpected exception copying a workflowDescriptor for workflow '" + clonedWorkflowName + "'!", e); } ConfigurableJiraWorkflow newWorkflow = new ConfigurableJiraWorkflow(clonedWorkflowName, workflowDescriptor, this); // Set description if we have one, otherwise set it to an empty string if (StringUtils.isNotEmpty(clonedWorkflowDescription)) { newWorkflow.setDescription(clonedWorkflowDescription); } else { newWorkflow.setDescription(""); } createActualWorkflow(user, newWorkflow); eventPublisher.publish(new WorkflowCopiedEvent(workflowToClone, newWorkflow)); return newWorkflow; }
newWorkflow.setDescription(description); workflowManager.createWorkflow(getLoggedInUser(), newWorkflow);
@RequiresXsrfCheck public String doAddWorkflow() throws Exception { if (!WorkflowUtil.isAcceptableName(newWorkflowName,"newWorkflowName",this)) { return INPUT; } else if (workflowManager.workflowExists(newWorkflowName)) { addError("newWorkflowName", getText("admin.errors.a.workflow.with.this.name.already.exists")); } if (invalidInput()) { return INPUT; } ConfigurableJiraWorkflow newWorkflow = new ConfigurableJiraWorkflow(newWorkflowName, workflowManager); newWorkflow.setDescription(description); workflowManager.createWorkflow(getLoggedInUser(), newWorkflow); UrlBuilder builder = new UrlBuilder("EditWorkflowDispatcher.jspa") .addParameter("wfName", newWorkflow.getName()) .addParameter("atl_token", getXsrfToken()); return returnCompleteWithInlineRedirect(builder.asUrlString()); }