RTC Java api list snapshots on a stream
sam matthews (4●3●4)
| asked Oct 23 '13, 4:28 a.m.
retagged Dec 03 '13, 4:48 p.m. by David Lafreniere (4.8k●7)
I want to simply list the latest snapshot for a given stream using the java api.
Any code example would be great.
Thanks |
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. Ralph Schoon selected this answer as the correct answer
|
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.