It's all about the answers!

Ask a question

Setting the last baseline while adding a component


Michele Pegoraro (1.8k14118103) | asked Oct 05 '11, 12:36 p.m.
Hi,
I'm working on a server side extension which add a component to a stream. I'm using this code:

IWorkspaceHandle udcStream  = listOfStream.get(0);

...
List<IComponentOpDescriptor> componentOpDescriptorList = new ArrayList<IComponentOpDescriptor>();
...
List<IComponentHandle> componentList = scmQuery.findComponents(componentCriteria, 1, null).getItemHandles();
IComponentHandle componentHandle = componentList.get(0);
componentOpDescriptorList.add(IComponentOpDescriptor.FACTORY.addComponent(componentHandle, true));
...
scmService.updateComponents2(udcStream, null, (IComponentOpDescriptor[])componentOpDescriptorList.toArray(new IComponentOpDescriptor[componentOpDescriptorList.size()]), false, false, ScmDtoFactory.eINSTANCE.createWorkspaceRefreshParameter(), null, null);


It works good, excepting for one thing: the component which I add has only the initial baseline. How can I set another baseline?


Thanks,
Michele.

One answer



permanent link
Dax Haslam (2025) | answered Mar 01 '13, 3:53 p.m.
 Old Question I know but thought I'd share what I found because I faced the same issue:

You have to find the baseline handle and componentHandle you want (https://jazz.net/forum/questions/34375/how-to-retrieve-the-name-of-a-baseline-set) and then use them when adding the components like this:

componentOpDescriptorList.add(IComponentOpDescriptor.FACTORY.addComponent(componentHandle, baselineHandle, true));
	

You can also use IComponentOpDescriptor.FACTORY to build the array for you like this:

scmService.updateComponents2(udcStream, null, IComponentOpDescriptor.FACTORY.array(IComponentOpDescriptor.FACTORY.addComponent(componentHandle, baselineHandle, true), false, false, ScmDtoFactory.eINSTANCE.createWorkspaceRefreshParameter(), null, null);
		

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.