It's all about the answers!

Ask a question

Is there a API to get the name of only latest snapshot from the stream?


Pushpa Gangadharaiah (131) | asked Aug 04 '21, 3:47 a.m.

 The use case is I have IWorkspaceConnection object and I need to fetch the name of the latest snapshot. There is a api ".getBaselineSets(IProgressMonitor)" , however it lists all the snapshot and the javadocs says "The items in the list not specified to be in any particular order" . Is the first object in the list is the latest one or Is there any other api's to fetch the latest snapshot details?

One answer



permanent link
Luca Martinucci (1.0k396112) | answered Aug 05 '21, 10:30 a.m.

As far as I know, to fetch the latest snapshot you have to retrieve the creation dates and compare them. 

Pehaps this code snippet I used some time ago for this purpose can help you:

List<?> snapshots = reportStreamConn.getBaselineSets(monitor);
for (Object snapshotObj : snapshots) {
  IBaselineSetHandle snapshotHandle = (IBaselineSetHandle) snapshotObj;   
  IBaselineSet snapshot = (IBaselineSet) repo.itemManager().fetchCompleteItem(snapshotHandle,   IItemManager.DEFAULT, monitor);
  Date snapshotCreationDate = snapshot.getCreationDate();
// compare the dates and retrieve the most recent
// .....
}

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.