回溯API:查找已知父项下的所有叶节点故事 [英] Lookback API: Find all leaf node stories under a known parent

查看:124
本文介绍了回溯API:查找已知父项下的所有叶节点故事的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Rally Webservices API中,如果我想遍历Story层次结构,则有必要对父故事进行查询,然后从返回的Stories中获取Children集合,然后递归地对每个Child进行查询,直到该过程达到了Leaf节点的结果.

In Rally Webservices API, if I want to traverse a Story hierarchy, it's necessary to do a query for the parent story, then grab the Children collection(s) off of the returned Stories, and then recursively query on each Child until the process reaches the Leaf node results.

问题-通过在Lookback API中使用单个查询,是否有一种方便的方法而无需进行迭代呢?

Question - is there a handy way to do this without iterating, by using a single query in the Lookback API?

推荐答案

这是Lookback API的最佳功能之一.

This is one of the best features of the Lookback API.

假设您具有此层次结构:

Let's say you have this hierarchy:

  • 故事444
    • 故事555
      • 故事666
        • 缺陷777(通过需求"字段)
          • 任务12
          • Story 444
            • Story 555
              • Story 666
                • Defect 777 (via the Requirement field)
                  • Task 12

                  任务12的文档如下所示:

                  The document for Task 12 would look like this:

                  {
                    ObjectID: 12,
                    _Type: "Task",
                    WorkProduct: 777,
                    _ItemHierarchy: [444, 555, 666, 777, 12],
                    ...
                  }
                  

                  因此,当您针对具有数组值的字段(例如_ItemHierarchy)提交查询时,它将与数组的任何成员匹配.

                  So when you submit a query against a field with an array value (like _ItemHierarchy), it will match any member of the array.

                  要获取444以后的所有内容,您的find子句应包含_ItemHierarchy: 444.看看它与任务12的_ItemHierarchy值如何匹配?

                  To get everything that descend from 444 your find clause would include _ItemHierarchy: 444. See how that matches the _ItemHierarchy value for Task 12?

                  要获取333以后的所有内容,您的find子句应包含_ItemHierarchy: 333.这也与任务12相匹配.

                  To get everything that descend from 333 your find clause would include _ItemHierarchy: 333. This also matches on Task 12.

                  要只获取444的故事(所有故事),您的find子句应包括:

                  To get just the Stories that descend from 444 (all Stories) your find clause would include:

                    _ItemHierarchy: 444,
                    _Type: "HierarchicalRequirement"
                  

                  要仅获取叶子故事,只需添加子句Children: null.

                  To get just the leaf Stories just add the clause Children: null.

                  _ItemHierarchy也一直到PortfolioItems.

                  The _ItemHierarchy also goes all the way up to PortfolioItems.

                  _ItemHierarchy已建立索引,因此这些查询应该非常有效.

                  _ItemHierarchy is indexed so these queries should be very efficient.

                  这篇关于回溯API:查找已知父项下的所有叶节点故事的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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