public ActionDescriptor getAction(final int id) { return delegate.getAction(id); }
ActionDescriptor getActionDescriptor(Issue issue, int actionId) { final JiraWorkflow workflow = workflowManager.getWorkflow(issue); if (workflow == null) { return null; } final WorkflowDescriptor descriptor = workflow.getDescriptor(); if (descriptor == null) { return null; } return descriptor.getAction(actionId); }
public Map<String, Object> toMap(Map transientVars, ApplicationUser user, MutableIssue issue) { final WorkflowEntry entry = (WorkflowEntry) transientVars.get(ENTRY); final ImmutableMap.Builder<String, Object> transition = ImmutableMap.builder(); final Integer actionId = (Integer) transientVars.get(ACTION_ID); final WorkflowDescriptor workflowDescriptor = (WorkflowDescriptor) transientVars.get(WORKFLOW_DESCRIPTOR); final ActionDescriptor actionDescriptor = workflowDescriptor.getAction(actionId); final Step createdStep = (Step) transientVars.get(CREATED_STEP); final WorkflowStore workflowStore = (WorkflowStore) transientVars.get(WORKFLOW_STORE); transition.put(WORKFLOW_ID, entry.getId()) .put(WORKFLOW_NAME, entry.getWorkflowName()) .put(TRANSITION_ID, actionId) .put(TRANSITION_NAME, actionDescriptor.getName()) .put(FROM_STATUS, findPreviousStatus(createdStep, entry, workflowStore, workflowDescriptor)) .put(TO_STATUS, getToStatus(workflowDescriptor, createdStep)); final ImmutableMap.Builder<String, Object> transitionContext = ImmutableMap.builder(); transitionContext.put(TRANSITION_CONTEXT, transition.build()) .put(COMMENT, transientVars.get(COMMENT) != null ? transientVars.get(COMMENT) : "") .put(USER, user != null ? userBeanFactory.createBean(user) : ""); transitionContext.put(ISSUE, issueBeanFactory.createBean(issue)); transitionContext.put(TIMESTAMP, createdStep.getStartDate().getTime()); return transitionContext.build(); }
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; }
private ActionDescriptor getActionDescriptor(Issue issue, String actionId) { final JiraWorkflow workflow = workflowManager.getWorkflow(issue); if (workflow == null) { return null; } final WorkflowDescriptor descriptor = workflow.getDescriptor(); if (descriptor == null) { return null; } try { return descriptor.getAction(Integer.valueOf(actionId)); } catch (NumberFormatException e) { return null; } } }
@Override public Collection<ActionDescriptor> getAvailableActions(final Issue issue, final TransitionOptions transitionOptions, final ApplicationUser user) { final int[] actionIds = getAvailableActionIds(issue, transitionOptions, user); final Collection<ActionDescriptor> availableActions = new ArrayList<ActionDescriptor>(actionIds.length); final WorkflowDescriptor workflowDescriptor = workflowManager.getWorkflow(issue).getDescriptor(); for (final int actionId : actionIds) { final ActionDescriptor action = workflowDescriptor.getAction(actionId); if (action == null) { log.error("State of issue [" + issue + "] has an action [id=" + actionId + "] which cannot be found in the workflow descriptor"); } else { availableActions.add(action); } } return availableActions; }
public String getTransitionName(final String workflowName, final String actionDescriptorId) { final JiraWorkflow workflow = ComponentAccessor.getWorkflowManager().getWorkflow(workflowName); final ActionDescriptor descriptor = workflow.getDescriptor().getAction(Integer.parseInt(actionDescriptorId)); @SuppressWarnings ("unchecked") final Map<String, String> metadata = descriptor.getMetaAttributes(); if (metadata.containsKey(JiraWorkflow.JIRA_META_ATTRIBUTE_EDIT_ALLOWED)) { final String key = metadata.get(JiraWorkflow.JIRA_META_ATTRIBUTE_EDIT_ALLOWED); final I18nBean i18nBean = new I18nBean(); final String value = i18nBean.getText(key); if ((value != null) && !"".equals(value.trim()) && !value.trim().equals(key.trim())) { return value; } } return descriptor.getName(); }
@Override public ActionDescriptor get() { return workflowManager.getWorkflow(getIssue()).getDescriptor().getAction(actionId); } });
public ActionDescriptor getActionDescriptor(WorkflowTransitionKey workflowTransitionKey) { String workflowName = workflowTransitionKey.getWorkflowName(); String actionDescriptorId = workflowTransitionKey.getActionDescriptorId(); JiraWorkflow workflow = workflowManager.getWorkflow(workflowName); return workflow.getDescriptor().getAction(Integer.parseInt(actionDescriptorId)); }
final Integer actionId = (Integer) transientVars.get(ACTION_ID); final Issue originalIssue = (Issue) transientVars.get(ORIGINAL_ISSUE_OBJECT); final ActionDescriptor action = descriptor.getAction(actionId); final String firstStepName = (originalIssue == null) ? "" : originalIssue.getStatusObject().getName(); final String endStepName = descriptor.getStep(action.getUnconditionalResult().getStep()).getName();
public ActionDescriptor getActionDescriptor(WorkflowProgressAware workflowProgressAware) throws Exception { JiraWorkflow workflow = getWorkflow(workflowProgressAware.getIssue().getGenericValue()); return workflow.getDescriptor().getAction(workflowProgressAware.getAction()); }
@Nonnull @Override public String getNextStatusIdForAction(@Nonnull final Issue issue, final int actionId) { JiraWorkflow workflow = getWorkflow(issue); if (workflow == null) { throw new IllegalStateException("There is no workflow for the issue with key " + issue.getKey()); } ActionDescriptor action = workflow.getDescriptor().getAction(actionId); if (action == null) { throw new IllegalStateException("There is no action descriptor for an action with id " + actionId); } int stepId = action.getUnconditionalResult().getStep(); if (stepId == JiraWorkflow.ACTION_ORIGIN_STEP_ID) { return issue.getStatusObject().getId(); } StepDescriptor step = workflow.getDescriptor().getStep(stepId); return workflow.getLinkedStatusId(step); }
private ActionDescriptor getActionDescriptor() { Workflow wf = workflowManager.makeWorkflow(getLoggedInUser()); long workflowId = getIssue().getLong("workflowId"); WorkflowDescriptor wd = wf.getWorkflowDescriptor(wf.getWorkflowName(workflowId)); return wd.getAction(action); }
public IssueOperation getIssueOperation() { final BulkOperationManager bulkOperationManager = ComponentAccessor.getBulkOperationManager(); if (BulkWorkflowTransitionOperation.NAME.equals(getOperationName())) { final JiraWorkflow workflow = ComponentAccessor.getWorkflowManager().getWorkflow( getSelectedWFTransitionKey().getWorkflowName()); final ActionDescriptor action = workflow.getDescriptor() .getAction(Integer.parseInt(getSelectedWFTransitionKey().getActionDescriptorId())); // Need to construct a new object as we need to pass in the Action Descriptor of the workflow action that is // being executed. Cannot get away with a singleton here. return new BulkTransitionIssueOperation(bulkOperationManager.getProgressAwareOperation(getOperationName()), action); } else { return bulkOperationManager.getOperation(getOperationName()); } }