Hi, I'm newbie to Jira plugin development. I need get all issues for specific project by specifying type.
I've tried JqlQueryBuilder, but it's very slow.
Currently I'm getting list of all issues for project and then filtering them:
Collection<Long> issuesIds = issueManager.getIssueIdsForProject(project.getId());
List<Issue> issues = issueManager.getIssueObjects(issuesIds);
However it's not best solution, since getting all issues for project taking also lots of time (less then JqlQueryBuilder, but still too much).
Is there any chance to specify issue type for search to cut unwanted issues?
After further investigation I've figured out the way how specify issue type and sprint in JqlQueryBuilder query:
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField customField = customFieldManager.getCustomFieldObjectByName("Sprint");
SearchService searchProvider = ComponentAccessor.getComponentOfType(SearchService.class);
JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();
builder.where()
.project(project.getId())
.and()
.sub()
.issueType("Story").or().issueType("Bug")
.endsub()
.and()
.customField(customField.getIdAsLong()).eq(sprint.trim());
SearchResults results = searchProvider
.searchOverrideSecurity(user, builder.buildQuery(), PagerFilter.getUnlimitedFilter());
List<Issue> issues = results.getIssues();
As result you're getting all desired issues.
In Jira 8, getIssues() method has been replaced with getResults()
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.