It's all about the answers!

Ask a question

Add Component from Stream to other Stream or workspace (RTC 4.0.4)

Christel Pedelaborde (112) | asked Jan 28 '14, 3:14 a.m.
edited Jan 28 '14, 11:25 a.m.

I am facing a problem while adding Component from a Stream to another new stream or Workspace with java API. Everything seems to be fine using API, but when I try to load this new workspace, I can see the component but not its root folder.
Then I tried to do it from RTC client, and saw I can get Component from "Component Baseline" or "Component in another repository or stream". If I use the 2nd option, I can "inheritate" from the Component root folder . But if I select the 1rst option (reference component), I onyl see the component name and no root folder content when I try to load. Then as a conclusion: I want the same behaviour as the 2nd option "Component in another repository or stream", by using API.
Then my question is: how to get the same from API?

The APIs I am currently using:
IWorkspaceConnection.getComponentsInfo() to get list of components of my referenced stream
And then, to add component:
IWorkspaceConnection newWK = ...;
IComponentAdditionOp addOperation = newWK.componentOpFactory().addComponent(cmp.getComponent(), false);
newWK.applyComponentOperations(Collections.singletonList(addOperation), monitor);

 For information: The component I am dealing with is 'projectScoped' and is the default one created with SCRUM project areas.
Did I miss something? Do I need to create and use a specific baseline?

Thanks for any help.


One answer

permanent link
Christel Pedelaborde (112) | answered Jan 28 '14, 11:19 a.m.
 Just for information, I finally could get what I wanted:
In case anyone would be interested in that post, here is how I could get my solution:
* get Component (simply with refStream.getComponents() )
* add component to my new stream (newStream.applyComponentOperations(...)
* compare both streams and deliver into new stream change sets from reference stream:

IChangeHistorySyncReport changeSetSync = refStream.compareTo(newStream, ...)
refStream.deliver(newStream, changeSetSync, Collections.EMPTY_LIST,  changeSetSync.outgoingChangeSets(component),  monitor);

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.