Setting the last baseline while adding a component
![](http://jazz.net/_images/myphoto/64dd52320b9af5c92b76f5a38ad571f5.jpg)
Hi,
I'm working on a server side extension which add a component to a stream. I'm using this code:
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.
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
![](http://jazz.net/_images/myphoto/64dd52320b9af5c92b76f5a38ad571f5.jpg)
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);