javarallylookbackapi

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


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.


Solution

  • I'm not familiar with the java toolkit, but using the raw Lookback API, you would accomplish this with a filter clause like {"_PreviousValues.PlanEstimate": {"$exists": true}}.