How to get Project Area History using java API
One answer
private static IProjectArea getFirstProjectAreaState(ITeamRepository repo, IProjectArea projectArea) throws TeamRepositoryException{
List history = repo.itemManager().fetchAllStateHandles(projectArea, null);
List<IProjectArea> projectAreas = (List<IProjectArea>)repo.itemManager().fetchCompleteStates(history, null);
Collections.sort(projectAreas, new Comparator<IProjectArea>(){
public int compare(IProjectArea o1, IProjectArea o2) {
int result = 0;
if (o1.modified().getTime() < o2.modified().getTime()) {
result = -1;
} else {
result = 1;
}
return result;
}
});
IProjectArea firstHistoryEntry = projectAreas.get(0);
return firstHistoryEntry;
}