Hi all,
As part of trying to resolve https://answers.atlassian.com/questions/28870803, I am trying to get a list of all issues in a project in a plugin. This will then be used by the client to delete all issues.
The first step is to get all issues, but I see that getProjectIssues is deprecated at https://developer.atlassian.com/static/javadoc/jira/6.4.1/reference/com/atlassian/jira/issue/IssueManager.html#getProjectIssues(org.ofbiz.core.entity.GenericValue)
That page mentions that I should be using a search provider instead, but does not link to what that is or an example of that.
What I'm trying to do is get all issues for a project, identify which are subtasks and delete those, then delete all remaining tasks, then delete the project.
Any input into the best way to get all issues for large projects (20,000+ issues) would be greatly appreciated!
Community moderators have prevented the ability to post new answers.
Hi,
Try JQL... process all results at once or implement your own way of handling numerous results using for instance PageFilter:
SearchProvider searchProvider = ComponentAccessor.getComponentOfType(SearchProvider.class); List<Issue> fetchedIssues; JqlQueryBuilder builder = JqlQueryBuilder.newBuilder(); builder.where().issueType().eq("Sub-Task").and().project(projectId); try { final SearchResults results = searchProvider.searchOverrideSecurity(builder.buildQuery(), user, PagerFilter.getUnlimitedFilter() , null); // if you have huge amount of issues try assemble something using PageFilter.newPageAlignedFilter(0, 100) // then process it page by page. fetchedIssues = results.getIssues(); } catch (SearchException e1) { e1.printStackTrace(); }
Thanks - looks good. That'll be a lot of iterations for 2,000 issues, but at least it keeps me under the barrier for large search results in JQL. Thanks again,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do the same thing since I have had the internal delete project fail on me way too many times and have then had to go though and clean it up.
If you want a pure REST solution, use JQL.
/rest/api/2/search?jql=project=ZAC&maxResults=2000&fields=key
Personally I use good old SQL (oracle example below) so I am not limited to JIRA timeouts, max results or anything jira.
SELECT ID FROM JIRAISSUE JI, PROJECT P WHERE JI.PROJECT = P.ID and P.PKEY = '<YOUR KEY HERE>'
Also note that you don't have to delete subtasks before deleting an issue; Just add "?deleteSubtasks=true" to your REST URL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use JIRA Command Line Interface (CLI).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, Jira CLI is not suitable in our environment for a number of reasons.
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.