Displaying Jira issues using Issue Navigator

2019-08-12 02:05发布

Below is simple Jira JQL search statement:

JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();
builder.where().assignee().in("Dylan").and().unresolved();


Query query = builder.buildQuery();

Then we have search results:

SearchResults results = searchService.search(authenticationContext.getUser(),
            query, PagerFilter.getUnlimitedFilter());


List<Issue> issues = results.getIssues();

Problem: I need to find issues, filter them using several criteria and show results to the user using standard Jira Issue Navigator window (I don't want to create my own velocity template for it). I know, that it is possible to link JQL query string safely to an existing URL that points at the Issue Navigator. The main problem is that I have to compare two date fields of the issue (due date and resolution) and such comparison can't be done with JQL. So, I can't write query entirely with JQL. I have to mix JQL with standard Java (for date comparison, which is no problem at all).

So, my MAIN QUESTION is this: then I have a list of issues List issues = results.getIssues(), is it possible to display them using Issue Navigator? And how?

标签: jira jql
1条回答
太酷不给撩
2楼-- · 2019-08-12 02:31

Once you have the List issues you can create an array of Strings with the same size, and save all issues keys into this query result. Than, you can create a filter of the sort:

issueKey in (ABC-1,ABC-2,ABC-3,...)

or via URL:

https://your.jira.com/secure/IssueNavigator!executeAdvanced.jspa?jqlQuery=issuekey+in+%28%22ABC-1%22%2C%22ABC-2%22%29&runQuery=true&clear=true

Having said that, I'm not so sure you can't find an easier solution using a JQL query, what is it that you are trying to achieve? The basic JQL gives some date-search abilities:

resolutionDate < "2013/01/01" and duedate < now()

Have a look at JIRA's Advanced Searching for more information.

If the standard JQL isn't enough, check out existing plugins, such as JQL Tricks Plugin. Another option might be to create your own JQL search, check Adding a JQL Function to JIRA for more info about this solution.

Let me know if you need help and good luck!

查看更多
登录 后发表回答