问题描述
下面是简单的Jira JQL搜索语句:
Below is simple Jira JQL search statement:
JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();
builder.where().assignee().in("Dylan").and().unresolved();
Query query = builder.buildQuery();
然后我们有搜索结果:
SearchResults results = searchService.search(authenticationContext.getUser(),
query, PagerFilter.getUnlimitedFilter());
List<Issue> issues = results.getIssues();
问题:我需要查找问题,使用多个条件过滤问题,并使用标准的Jira Issue Navigator窗口向用户显示结果(我不想为此创建自己的速度模板) .我知道,可以将JQL查询字符串安全地链接到指向问题导航器的现有URL.主要问题是我必须比较问题的两个日期字段(到期日期和解决方案),而JQL无法完成这样的比较.因此,我无法完全使用JQL编写查询.我必须将JQL与标准Java混合使用(用于日期比较,这完全没有问题).
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).
所以,我的主要问题是这样的:然后我有一个问题列表List issues = results.getIssues()
,是否可以使用问题导航器显示它们?以及如何?
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?
推荐答案
一旦有了List issues
,您就可以创建一个大小相同的字符串数组,并将所有问题密钥保存到此查询结果中.然后,您可以创建以下过滤器:
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,...)
或通过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
话虽如此,但我不确定您无法使用JQL查询找到更简单的解决方案,您要实现的目标是什么?基本的JQL提供了一些日期搜索功能:
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()
有关更多信息,请参见 JIRA的高级搜索
Have a look at JIRA's Advanced Searching for more information.
如果标准JQL还不够,请检查现有的插件,例如 JQL Tricks插件.另一个选择可能是创建自己的JQL搜索,请检查向JIRA添加JQL函数以获取有关此解决方案的更多信息.
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!
这篇关于使用问题导航器显示Jira问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!