RTC Java api list snapshots on a stream
Accepted answer
Firstly, snapshots are called baseline sets in the RTC Plain Java API. Knowing this, you can get the snaptshots via IWorkspaceManager.findBaselineSets():
ITeamRepository repository = ...;
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repository);
Just hand in your given stream as the workspaceHandle to the following method:
@SuppressWarnings("unchecked")
private List<IBaselineSetHandle> getBaselineSetHandles(IWorkspaceHandle workspaceHandle)
throws TeamRepositoryException {
IBaselineSetSearchCriteria searchCriteria = IBaselineSetSearchCriteria.FACTORY.newInstance();
searchCriteria.setOwnerWorkspaceOptional(workspaceHandle);
return workspaceManager.findBaselineSets(searchCriteria, Integer.MAX_VALUE, monitor);
}
Then you can loop through the returned List<IBaselineSetHandle> and get each BaseLineSet (== snapshot) with the following method:
private IBaselineSet getBaselineSet(IBaselineSetHandle baselineSetHandle)
throws TeamRepositoryException {
return (IBaselineSet) repository.itemManager().fetchCompleteItem(baselineSetHandle, IItemManager.DEFAULT, monitor);
}
Hopefully, that is of help.
ITeamRepository repository = ...;
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repository);
Just hand in your given stream as the workspaceHandle to the following method:
@SuppressWarnings("unchecked")
private List<IBaselineSetHandle> getBaselineSetHandles(IWorkspaceHandle workspaceHandle)
throws TeamRepositoryException {
IBaselineSetSearchCriteria searchCriteria = IBaselineSetSearchCriteria.FACTORY.newInstance();
searchCriteria.setOwnerWorkspaceOptional(workspaceHandle);
return workspaceManager.findBaselineSets(searchCriteria, Integer.MAX_VALUE, monitor);
}
Then you can loop through the returned List<IBaselineSetHandle> and get each BaseLineSet (== snapshot) with the following method:
private IBaselineSet getBaselineSet(IBaselineSetHandle baselineSetHandle)
throws TeamRepositoryException {
return (IBaselineSet) repository.itemManager().fetchCompleteItem(baselineSetHandle, IItemManager.DEFAULT, monitor);
}
Hopefully, that is of help.