如何使用回溯获取计划估算更改的功能记录 API

How to get features record for plan estimate change using lookback API

我在 java 中使用反弹回顾 api。我正在尝试获取历史数据功能,我使用的示例代码如下所示。

LookbackApi lookbackApi = new LookbackApi();

lookbackApi.setCredentials("username", "password");
lookbackApi.setWorkspace(47903209423);
lookbackApi.setServer("https://rally1.rallydev.com");
//lookbackApi.setWorkspace("90432948"); 

LookbackQuery query = lookbackApi.newSnapshotQuery();
query.addFindClause("_TypeHierarchy", "PortfolioItem/Feature");
query.setPagesize(200)                      // set pagesize to 200 instead of the default 20k
.setStart(200)                      // ask for the second page of data        
.requireFields("ScheduleState",     // A useful set of fields for defects, add any others you may want
               "ObjectID",
               "State",
               "Project",
               "PlanEstimate",
               "_ValidFrom",
               "_ValidTo")
.sortBy("_UnformattedID")        
.hydrateFields("ScheduleState","State", "PlanEstimate","Project");    // ScheduleState will come back as an OID if it doesn't get hydrated      

LookbackResult resultSet = query.execute();


int resultCount = resultSet.Results.size();
Map<String,Object> firstSnapshot = resultSet.Results.get(0);

Iterator<Map<String,Object>> iterator = resultSet.getResultsIterator();
while (iterator.hasNext()) {
    Map<String, Object> snapshot = iterator.next();
}

我需要一种设置条件的方法,以便它从历史记录中获取计划估计已更改的所有记录,但会忽略任何功能和基础用户故事的其他历史记录。我需要这种方式,以便我们可以跟踪计划估算的变化,但是,将能够避免获取不必要的数据并减少执行此操作的时间。

我不熟悉 java 工具包,但使用原始回溯 API,您可以使用像 {"_PreviousValues.PlanEstimate": {"$exists": true}} 这样的过滤器子句来完成此操作。

    Map ifExist = new HashMap();
    ifExist.put("$exists",  true); 
    // Note:- true is java boolean, be careful with this as string "true" will not work.
    query.addFindClause("_PreviousValues.PlanEstimate",ifExist);

此外,需要考虑将“_PreviousValues.PlanEstimate”添加到 .requireFields() 以防只有 "PlanEstimate" 需要水合