Displaying Jira issues using Issue Navigator

老子叫甜甜 提交于 2019-12-24 08:48:23

问题


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?


回答1:


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!



来源:https://stackoverflow.com/questions/14945588/displaying-jira-issues-using-issue-navigator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!