@Override public String getLinkedStatusId(final StepDescriptor stepDescriptor) { if (stepDescriptor == null) { throw new IllegalArgumentException("Step cannot be null."); } if ((stepDescriptor.getMetaAttributes() != null) && stepDescriptor.getMetaAttributes().containsKey(STEP_STATUS_KEY)) { return (String) stepDescriptor.getMetaAttributes().get(JiraWorkflow.STEP_STATUS_KEY); } throw new IllegalStateException("Step with id '" + stepDescriptor.getId() + "' does not have a valid linked status."); }
private Integer getStepId(final JiraWorkflow workflow, final ActionDescriptor transition) { // Get the first step that feeds into this transition, and see if the step has a direct link to it. // If not, the transition is a global or initial transition, and we shouldn't provide a step ID. // See com.atlassian.jira.web.util.component.RequestComponentManager#injectWorkflow to understand why. final Collection<StepDescriptor> steps = workflow.getStepsForTransition(transition); if (!steps.isEmpty()) { final StepDescriptor step = steps.iterator().next(); if (step.getAction(transition.getId()) != null) { return step.getId(); } } return null; }
public String getCancelUrl() { StringBuilder url = new StringBuilder("ViewWorkflowTransition.jspa") .append(getBasicWorkflowParameters()); if (getStep() != null) { url.append("&workflowStep=" + getStep().getId()); } url.append("&workflowTransition=" + action.getId()); return url.toString(); }
public String getCancelUrl() { if ("viewWorkflowStep".equals(getOriginatingUrl())) { return "ViewWorkflowStep.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + step.getId(); } return "ViewWorkflowSteps.jspa" + getBasicWorkflowParameters(); } }
public String getCancelUrl() { if ("viewWorkflowStep".equals(getOriginatingUrl())) { return "ViewWorkflowStep.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + step.getId(); } return "ViewWorkflowSteps.jspa" + getBasicWorkflowParameters(); } }
public String getRemoveAttributeUrl(String key) { return "RemoveWorkflowStepMetaAttribute.jspa" + getBasicWorkflowParameters() + "&atl_token=" + getXsrfToken() + "&workflowStep=" + getStep().getId() + "&attributeKey=" + URLEncoder.encode(key); }
public String getCancelUrl() { if ("viewWorkflowStep".equals(getOriginatingUrl())) { return "ViewWorkflowStep.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + step.getId(); } return "ViewWorkflowSteps.jspa" + getBasicWorkflowParameters(); }
public String getStepId(long actionDescriptorId, String workflowName) { int actionDescId = new Long(actionDescriptorId).intValue(); String stepId = null; JiraWorkflow workflow = getWorkflow(workflowName); ActionDescriptor actionDescriptor = workflow.getDescriptor().getAction(actionDescId); if (actionDescriptor != null) { Collection<StepDescriptor> stepsForTransition = workflow.getStepsForTransition(actionDescriptor); for (final StepDescriptor stepDescriptor : stepsForTransition) { stepId = String.valueOf(stepDescriptor.getId()); break; } } return stepId; }
public Collection getStepsWithAction(final StepDescriptor stepDescriptor) { // If global Action final Collection actions = getAllActions(); actionloop : for (final Iterator iterator = actions.iterator(); iterator.hasNext();) { final ActionDescriptor actionDescriptor = (ActionDescriptor) iterator.next(); // Check all conditional results for (final Object o : actionDescriptor.getConditionalResults()) { final ResultDescriptor resultDescriptor = (ResultDescriptor) o; if (resultDescriptor.getStep() == stepDescriptor.getId()) { // The step is a destination step for action's conditional result // Leave the action in the collection continue actionloop; } } // Now check the unconditional result if (actionDescriptor.getUnconditionalResult().getStep() != stepDescriptor.getId()) { // If the step is not a destination of any conditional and unconditional result remove the action from the list iterator.remove(); } } return actions; }
public String getCancelUrl() { if ("viewWorkflowStep".equals(getOriginatingUrl())) { return "ViewWorkflowStep.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + getStep().getId(); } else { return "ViewWorkflowSteps.jspa" + getBasicWorkflowParameters(); } }
private String getViewRedirect() throws Exception { return getRedirect("ViewWorkflowStepMetaAttributes.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + getStep().getId()); }
/** * This method is used to determine if workflowstep belongs to a draft workflow and is present on the original * workflow that was used to create the draft. * This means this step cannot be deleted, and cannot be associated with a different status. * @param stepDescriptor The stepDescriptor in being edited. * @return True if the step is an existing step and the workflow is a draft workflow */ public boolean isOldStepOnDraft(StepDescriptor stepDescriptor) { // First check if it is a draft workflow if (!workflow.isDraftWorkflow()) { return false; } // Does this step exist in the live workflow? JiraWorkflow jiraWorkflow = workflowService.getWorkflow(getJiraServiceContext(), workflow.getName()); return jiraWorkflow.getDescriptor().getStep(stepDescriptor.getId()) != null; }
public String doDefault() throws Exception { if (workflowService.isStepOnDraftWithNoTransitionsOnParentWorkflow(getJiraServiceContext(), getWorkflow(), getStep().getId())) { addErrorMessage(getText("admin.workflowtransitions.error.add.transition.draft.step.without.transition", getStep().getName())); } return super.doDefault(); }
@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()); }
protected String getViewRedirect(String postfix) { if (getStep() == null) { return getRedirect("ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowTransition=" + getTransition().getId() + postfix); } else { return getRedirect("ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + getStep().getId() + "&workflowTransition=" + getTransition().getId() + postfix); } }
protected String getRedirectUrl() { if (getStep() == null) { return "ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowTransition=" + getTransition().getId() + "&atl_token=" + urlEncode(getXsrfToken()); } else { return "ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + getStep().getId() + "&workflowTransition=" + getTransition().getId() + "&atl_token=" + urlEncode(getXsrfToken()); } }
@RequiresXsrfCheck protected String doExecute() throws Exception { deleteWorkflowDescriptor(); workflowService.updateWorkflow(getJiraServiceContext(), getWorkflow()); if (getStep() == null) { return getRedirect("ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowTransition=" + getTransition().getId()); } else { return getRedirect("ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + getStep().getId() + "&workflowTransition=" + getTransition().getId()); } }
@RequiresXsrfCheck protected String doExecute() throws Exception { deleteWorkflowDescriptor(); workflowService.updateWorkflow(getJiraServiceContext(), getWorkflow()); if (getStep() == null) { return getRedirect("ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowTransition=" + getTransition().getId()); } else { return getRedirect("ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + getStep().getId() + "&workflowTransition=" + getTransition().getId()); } }
protected String getRedirectUrl() { // Redirect to the action that will query the user for workflow descriptor's parameters (if any) and actually create the // workflow descriptor if (getStep() == null) { return getParamsActionName() + getBasicWorkflowParameters() + "&workflowTransition=" + getTransition().getId() + "&pluginModuleKey=" + urlEncode(type) + "&atl_token=" + urlEncode(getXsrfToken()); } else { return getParamsActionName() + getBasicWorkflowParameters() + "&workflowStep=" + getStep().getId() + "&workflowTransition=" + getTransition().getId() + "&pluginModuleKey=" + urlEncode(type) + "&atl_token=" + urlEncode(getXsrfToken()); } }
protected String getRedirectUrl() { String redirectUrl; if (getStep() == null) { redirectUrl = "ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowTransition=" + getTransition().getId() + "¤tCount=" + getHighLightParamPrefix() + getCount(); } else { redirectUrl = "ViewWorkflowTransition.jspa" + getBasicWorkflowParameters() + "&workflowStep=" + getStep().getId() + "&workflowTransition=" + getTransition().getId() + "¤tCount=" + getHighLightParamPrefix() + getCount(); } if (TextUtils.stringSet(getCount())) { redirectUrl += "¤tCount=" + getCount(); } return redirectUrl; }