使用Taskadapter Redmine插件for Java搜索查询参数

时间:2019-04-30 15:04:22

标签: java redmine

我想使用taskadapter的Java Redmine插件进行一些搜索。

由于某种原因,当我添加“ closed_on”过滤器时,不会返回任何结果,即,在所有字段中返回的值为issueManager.getIssues(params)

如果我不使用或不使用“ closed_on”过滤器,而是删除所有其他过滤器(f []),则会得到预期的结果。

PS:我确定所选的日期范围会返回一些问题,并且我还尝试了很大的日期间隔。

这就是我所需要的,并且不会返回任何结果:

IssueManager issueManager = this.redmineManager.getIssueManager();

Params params = new Params()
                    .add("set_filter", "1")
                    .add("f[]", "status_id")
                    .add("v[status_id][]", "5")
                    .add("v[status_id][]", "10")
                    .add("v[status_id][]", "8")
                    .add("f[]", "closed_on")
                    .add("op[closed_on]", "><")
                    .add("v[closed_on][]", "2019-03-01")
                    .add("v[closed_on][]", "2019-03-05")
                    .add("f[]", "tracker_id")
                    .add("v[tracker_id][]", "1")
                    .add("project_id", "962");

ResultsWrapper<Issue> issues = issueManager.getIssues(params);

// This is the query produced: https://redmine.xxxxxxx.com/issues.json?set_filter=1&f[]=status_id&v[status_id][]=5&v[status_id][]=10&v[status_id][]=8&f[]=closed_on&op[closed_on]=%3E%3C&v[closed_on][]=2019-03-01&v[closed_on][]=2019-03-05&f[]=tracker_id&v[tracker_id][]=1&project_id=962&key=my_key
// If I enter that url in my browser I get a 500 HTTP status from Redmine.

但是,这可行:

IssueManager issueManager = this.redmineManager.getIssueManager();

Params params = new Params()
                    .add("set_filter", "1")
                    .add("f[]", "status_id")
                    .add("v[status_id][]", "5")
                    .add("v[status_id][]", "10")
                    .add("v[status_id][]", "8")
                    .add("f[]", "tracker_id")
                    .add("v[tracker_id][]", "1")
                    .add("project_id", "962");

ResultsWrapper<Issue> issues = issueManager.getIssues(params);

并且也这样做:

IssueManager issueManager = this.redmineManager.getIssueManager();

Params params = new Params()
                    .add("set_filter", "1")
                    .add("f[]", "closed_on")
                    .add("op[closed_on]", "><")
                    .add("v[closed_on][]", "2019-03-01")
                    .add("v[closed_on][]", "2019-03-05")
                    .add("project_id", "962");

ResultsWrapper<Issue> issues = issueManager.getIssues(params);

我已经比较了为这3个示例生成的url,但无法发现会使第一个示例中断的任何内容。

有人可以帮助我了解如何正确构成此过滤器吗?

0 个答案:

没有答案