Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RTC Java api list snapshots on a stream

 I want to simply list the latest snapshot for a given stream using the java api.

Any code example would be great.

Thanks

0 votes


Accepted answer

Permanent link
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

4 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 1,202
× 169

Question asked: Oct 23 '13, 4:28 a.m.

Question was seen: 7,792 times

Last updated: Dec 03 '13, 4:48 p.m.

Confirmation Cancel Confirm