Add Component from Stream to other Stream or workspace (RTC 4.0.4)
Hi,
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.
Christel
One answer
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);