Obtaining available workflow actions programmatically
Often in our programs, we may come across the need to retrieve the current workflow actions available on the issue. Let us have a look at how to do this using the JIRA API.
How to do it...
Follow these steps:
Retrieve the JIRA workflow object associated with the issue:
      JiraWorkflow workFlow =       ComponentAccessor.getWorkflowManager().getWorkflow(issue);
Here, the issue is the current issue, which is an instance of the
com.atlassian.jira.issue.Issueclass.Get the issue status and use it to retrieve the current workflow step linked to the issue:
      Status status = issue.getStatusObject();       com.opensymphony.workflow.loader.StepDescriptor currentStep =        workFlow.getLinkedStep(status);
Retrieve the set of available actions from the current step:
      List<ActionDescriptor> actions = currentStep.getActions();
Here,
actionsis a list ofcom.opensymphony.workflow.loader.ActionDescriptor.Iterate on the
ActionDescriptors...