0

I am using rally lookback api with java. I am trying to fetch historical data features, sample code that i am using is as shown below.

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();
}

I need a way to put a condition so that it will fetch all the records from history which will have plan estimate changed,but will ignore other history for any feature and underlying user story. I need it this way so that we can track plan estimate change but, will be able to avoid fetching un-necessary data and reduce the time to do this.

4

2 回答 2

1

我不熟悉 java 工具包,但是使用原始的 Lookback API,您可以使用过滤子句(如{"_PreviousValues.PlanEstimate": {"$exists": true}}.

于 2015-02-26T03:59:20.367 回答
0
    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”来补水

于 2015-03-02T06:07:38.700 回答