Rally Rest Api:QueryFilter:按时间戳获取缺陷 [英] Rally Rest Api: QueryFilter: Get defects by timestamp

查看:27
本文介绍了Rally Rest Api:QueryFilter:按时间戳获取缺陷的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 QueryFilter 来更新自时间戳以来的缺陷?像这样:

Is there a way to use the QueryFilter to get defects updated since a timestamp? Something like this:

String timeStamp = "2012-08-24T19:10:09.154Z";
QueryRequest defectRequest = new QueryRequest("defect");
defectRequest.setFetch(new Fetch("LastUpdateDate"));
defectRequest.setQueryFilter(new QueryFilter("LastUpdateDate", ">", timeStamp);
QueryResponse projectDefects = rallyApi.query(defectRequest);

推荐答案

Rally Web 服务 API 介绍页面有几个关于编写复杂查询的问题的解释(查看查询语法对象集合属性和查询部分).Java 版本确实可以轻松处理链表达式,但阅读起来有点困难.这是一个查询,用于整理自 8 月 1 日以来具有高严重性或优先级的开放缺陷:

The Rally Web Services API intro page has a couple of explanations of gotchas with writing complex queries (have a look at the Query Syntax and Object Collection Attributes and Queries sections). The Java version does handle chain expressions easily but it's a little hard to read. Here's a query that sorts out open defects since August 1st that have a high severity or priority:

String timeStamp = "2012-08-01T19:10:09.154Z";

Map<String, QueryFilter> filters = new HashMap<String, QueryFilter>();

filters.put("LastUpdateDate", new QueryFilter("LastUpdateDate", ">", timeStamp));
filters.put("State", new QueryFilter("State", "=", "Open"));
filters.put("Severity", new QueryFilter("Severity", "<=", "Major Problem"));
filters.put("Priority", new QueryFilter("Priority", "<=", "High Attention"));

// Evaluates to ((Severity <= Major Problem) OR (Priority <= High Attention)) AND ((LastUpdateDate > timeStamp) AND (State = Open))
QueryFilter complexFilter = filters.get("Severity").or(filters.get("Priority")).and(filters.get("LastUpdateDate").and(filters.get("State")));

一个大问题是查询集合属性(如用户故事中的任务).将查询链接在一起会得到错误的结果.例如,如果您要查找具有正在进行和已阻止的任务的用户故事,则查询会将表达式评估为 OR 语句.发生这种情况是因为查询将其转换为查找集合中具有阻止状态的任何任务,然后查找任何正在进行的任务".查询不会在第一个表达式之后缩小列表的范围;每个表达式查询集合中的所有任务.

A big gotcha is querying for attributes that are collections (like Tasks in User Stories). Chaining queries together will get you the wrong result. For example, if you're looking for user stories that have tasks that are both in progress AND blocked, the query will evaluate the expression as an OR statement. This happens because the query translates it to "find any task in the collection that has a blocked status and then find any task that's in progress." The query doesn't narrow the scope of the list after the first expression; each expression queries all of the tasks within the collection.

解决此问题的一种方法是执行其中一项查询(假设我们正在处理所有任务).然后,我们过滤该列表以获取所有被阻止的任务.获得过滤列表后,您可以找出每个任务属于哪个用户故事.

One way around this is to do one of the queries (let's say we get all tasks in-progress). Then, we filter that list to get all tasks that are blocked. After you get that filtered list, you can find out which User Story each of those tasks belong to.

参考文献:

上面链接的 Rally Web Services API.

The Rally Web Services API linked above.

http://developer.rallydev.com/help/java-toolkit-rally-rest-api(我使用页面末尾的最后一个示例作为创建上述查询过滤器的基础).

http://developer.rallydev.com/help/java-toolkit-rally-rest-api (I used the last example at the end of the page as a basis of creating the query filter above).

这篇关于Rally Rest Api:QueryFilter:按时间戳获取缺陷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆