Lookback API: Find all leaf node stories under a known parent

后端 未结 1 1563
一向
一向 2021-01-22 00:45

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 S

相关标签:
1条回答
  • 2021-01-22 00:56

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

    Let's say you have this hierarchy:

    • Story 444
      • Story 555
        • Story 666
          • Defect 777 (via the Requirement field)
            • Task 12
          • Task 13
      • Story 888

    The document for Task 12 would look like this:

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

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

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

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

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

      _ItemHierarchy: 444,
      _Type: "HierarchicalRequirement"
    

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

    The _ItemHierarchy also goes all the way up to PortfolioItems.

    _ItemHierarchy is indexed so these queries should be very efficient.

    0 讨论(0)
提交回复
热议问题