I would like to put an issue into a sprint via a scriptrunner post-action.
My problem is that I cannot access the SprintIssueService. The following code will return sprintIssueService not found:
import com.atlassian.jira.issue.Issue import com.atlassian.jira.component.ComponentAccessor import com.atlassian.plugin.PluginAccessor // get user and issue def jiraAuthenticationContext = ComponentAccessor.getJiraAuthenticationContext() def user = jiraAuthenticationContext.getUser() Issue issue = ComponentAccessor.getIssueManager().getIssueObject("ABC-123") // access greenhopper PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor(); Class greenHopperClass = pluginAccessor.getClassLoader().findClass("com.pyxis.greenhopper.GreenHopper"); def greenHopper = componentManager.getOSGiComponentInstanceOfType(greenHopperClass); if (! greenHopper ) { return "greeenHopper not found" } // access SprintIssueService Class sprintIssueServiceClass = pluginAccessor.getClassLoader().findClass("com.atlassian.greenhopper.service.sprint.SprintIssueService") def sprintIssueService = componentManager.getOSGiComponentInstanceOfType(sprintIssueServiceClass); if (! sprintIssueService ) { return "sprintIssueService not found" } else { return sprintIssueService.getSprintsForIssue(user, issue) }
Can someone help?
Community moderators have prevented the ability to post new answers.
As one can only access the sprints via REST api, one has to use some HTTPClient (e.g. org.apache.commons.httpclient.HttpClient) to get it done.
The last post of the following shows a code example of that:
From my experience most of the Service objects from GreenHopper are not exposed to other plugins. You'd be best attempting to do it via the REST interface. Not that GH has a published REST interface but you can discover it fine using the Developer Tools plugin and REST browser in that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's sad but I think you are right. The sprintIssueService is not public/exposed and the only way to access it is via REST. So I have to rethink my idea with a post-action :-/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.