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

How to get the snapshot handle via Java API?

I should modify the build definition using the last day snapshot. 
I know the snapshot name, and how can I get the snapshot handle?

Thanks!

0 votes



2 answers

Permanent link
I don't know, but this would probably be in the build toolkit

0 votes


Permanent link
The following code can work:
There is no snapshot class, instead of  IBaselineSet 
 
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);
IItemQueryPage itemQueryPage = wm.findWorkspacesByName(stream, true,
true, false, 2, monitor);
if (itemQueryPage.getSize() == 0) {
return null;
}
IWorkspaceHandle workspaceHandle = (IWorkspaceHandle) itemQueryPage
.getItemHandles().get(0);
IWorkspaceConnection connection = null;
if (connection == null) {
            connection = SCMPlatform.getWorkspaceManager(repo).getWorkspaceConnection(workspaceHandle, null);
            connection.getName();
        }
List<IBaselineSetHandle> handles = connection.getBaselineSets(null);
handles.size();
        List<IBaselineSet> items = connection.teamRepository().itemManager().fetchCompleteItems(handles, IItemManager.DEFAULT, null);
        for(int i=0;i<items.size();i++){
        System.out.println(items.get(i).getName());
       
        }

0 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,948

Question asked: Aug 25 '12, 5:51 a.m.

Question was seen: 4,989 times

Last updated: Sep 04 '12, 2:01 p.m.

Confirmation Cancel Confirm