public List getTransitionSteps() { List transitions = getWorkflow().getDescriptor().getSteps(); if(getTransition().getUnconditionalResult().getStep() == JiraWorkflow.ACTION_ORIGIN_STEP_ID) { StepDescriptor dummyStep = new DescriptorFactory().createStepDescriptor(); dummyStep.setId(JiraWorkflow.ACTION_ORIGIN_STEP_ID); dummyStep.setName(getText("admin.workflowtransitions.same.destination.step")); transitions.add(dummyStep); } return transitions; }
@RequiresXsrfCheck protected String doExecute() throws Exception { StepDescriptor stepDescriptor = getWorkflow().getDescriptor().getStep(step.getId()); stepDescriptor.setName(getStepName()); //For a draft workflow, you can only changed the linked status for new steps. if (!isOldStepOnDraft(step)) { stepDescriptor.getMetaAttributes().put(JiraWorkflow.STEP_STATUS_KEY, getStepStatus()); } workflowService.updateWorkflow(getJiraServiceContext(), getWorkflow()); return getRedirect(getCancelUrl()); }
public ConfigurableJiraWorkflow(final String name, final WorkflowManager workflowManager) { super(workflowManager, new WorkflowDescriptor()); this.name = name; // create the initial step - useful to have one of these :) final StepDescriptor step = DescriptorFactory.getFactory().createStepDescriptor(); step.setId(1); step.setName("Open"); step.getMetaAttributes().put(JiraWorkflow.STEP_STATUS_KEY, "1"); step.setParent(descriptor); descriptor.addStep(step); // create the initial action final ActionDescriptor initialAction = DescriptorFactory.getFactory().createActionDescriptor(); initialAction.setId(1); initialAction.setName("Create"); initialAction.setParent(descriptor); descriptor.addInitialAction(initialAction); // add create issue permission validator initialAction.getValidators().add(PermissionValidator.makeDescriptor("Create Issue")); // setup result to always be step 1 final ResultDescriptor resultDescriptor = DescriptorFactory.getFactory().createResultDescriptor(); resultDescriptor.setStep(1); resultDescriptor.setStatus("open"); initialAction.setUnconditionalResult(resultDescriptor); // setup post functions resultDescriptor.getPostFunctions().add(IssueCreateFunction.makeDescriptor()); resultDescriptor.getPostFunctions().add(IssueReindexFunction.makeDescriptor()); resultDescriptor.getPostFunctions().add(FireIssueEventFunction.makeDescriptor(EventType.ISSUE_CREATED_ID)); }
newStep.setName(getStepName()); newStep.setId(WorkflowUtil.getNextId(getWorkflow().getDescriptor().getSteps())); newStep.getMetaAttributes().put(JiraWorkflow.STEP_STATUS_KEY, getStepStatus());