public Collection getTransitions() { // The actions list should contain all the common and ordinary actions. // (And no global actions, which cannot be deleted from here). return step.getActions(); }
public Collection getOutboundTransitions() { // TODO add global actions Collection transitions = new LinkedList(step.getActions()); transitions.addAll(workflow.getDescriptor().getGlobalActions()); return transitions; }
actions.addAll(step.getActions());
private SortedMap<Integer, ActionDescriptor> getAllActionsMap() { final SortedMap<Integer, ActionDescriptor> actions = new TreeMap<Integer, ActionDescriptor>(); // Register all initial actions addActionsToMap(actions, descriptor.getInitialActions()); // Register all global actions addActionsToMap(actions, descriptor.getGlobalActions()); // Register all common actions actions.putAll(descriptor.getCommonActions()); // Register all normal actions final List steps = descriptor.getSteps(); for (final Object step : steps) { final StepDescriptor stepDescriptor = (StepDescriptor) step; for (final Object o : stepDescriptor.getActions()) { final ActionDescriptor actionDescriptor = (ActionDescriptor) o; // If the action id is already in the list - it is likely to be a common action :) // So no need to add it as it is already in the list if (!actions.containsKey(new Integer(actionDescriptor.getId()))) { actions.put(new Integer(actionDescriptor.getId()), actionDescriptor); } } } return actions; }
public boolean isStepOnDraftWithNoTransitionsOnParentWorkflow(final JiraServiceContext jiraServiceContext, final JiraWorkflow workflow, final int stepId) { if (workflow.isDraftWorkflow()) { //need to check the parent's step to see if it has any available actions. final JiraWorkflow parentWorkflow = getWorkflow(jiraServiceContext, workflow.getName()); final StepDescriptor originalStep = parentWorkflow.getDescriptor().getStep(stepId); //if the step exists on the original workflow (may not, it could be a new step added to the draft, //in which case we don't care) if (originalStep != null) { final List<?> availableActions = originalStep.getActions(); if ((availableActions == null) || availableActions.isEmpty()) { return true; } } } return false; }
if (transition != null) step.getActions().remove(transition); if (step.getActions().isEmpty() && step.getCommonActions().isEmpty())
for (final Object o : stepDescriptor.getActions())
public void validateAddWorkflowTransitionToDraft(final JiraServiceContext jiraServiceContext, final JiraWorkflow newJiraWorkflow, final int stepId) { if (!hasAdminPermission(jiraServiceContext)) { jiraServiceContext.getErrorCollection().addErrorMessage(getI18nBean().getText("admin.workflows.service.error.no.admin.permission")); return; } if (isStepOnDraftWithNoTransitionsOnParentWorkflow(jiraServiceContext, newJiraWorkflow, stepId)) { //original step didn't have any actions. Lets check if the new step DOES have any actions. final StepDescriptor newStep = newJiraWorkflow.getDescriptor().getStep(stepId); final List<?> newActions = newStep.getActions(); if ((newActions != null) && !newActions.isEmpty()) { jiraServiceContext.getErrorCollection().addErrorMessage( getI18nBean().getText("admin.workflowtransitions.error.add.transition.draft.step.without.transition", newStep.getName())); } } }
final Collection actions = stepDescriptor.getActions();
if (!stepInWorkflow.getActions().isEmpty())
@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()); }
checkDuplicateTransitionName(getStep().getActions(), getTransitionName());
checkDuplicateTransitionName(getStep().getActions(), getTransitionName());