It's all about the answers!

Ask a question

[RTC Java API] How to set component scope for flow target?

Tuan Nguyen Minh (691321) | asked Mar 26 '15, 10:34 p.m.
Hi, the use case for this question is: I have a Stream with 100 components, I create a Workspace connected to the Stream, I only add 10 components to my Workspace. Now, if I look at the Pending Changes view in Eclipse client, all changes are shown there: 10 changes from my 10 components & 90 component additions from the other 90... I only want to see the changes from my 10 components, so I edit the component scope by open the Workspace --> click on the Stream name in Flow Target table --> choose Edit --> in the Edit Flow Target window I choose "Flow only components checked below" option & choose the components to be flowed.
--> How can I do this with Java API? I try to use the following but no success:
IFlowTable#addAcceptFlow(source, remoteRepoIdentifier, remoteRepoURI, componentScopes, description) and
IFlowTable#addDeliverFlow(source, remoteRepoIdentifier, remoteRepoURI, componentScopes, description)

I've already supplied the component handle list into the parameter "componentScopes" but when I go back to Eclipse client to check, it still flow all components.
Below is the code I used:

IWorkspaceConnection wsCon;

IFlowNodeHandle nodeHandle;

flowTable = wsCon.getFlowTable().getWorkingCopy();

flowTable.addAcceptFlow(nodeHandle, repo.getId(), repo.getRepositoryURI(), wsCon.getComponents(), null);

flowTable.addDeliverFlow(nodeHandle, repo.getId(), repo.getRepositoryURI(), wsCon.getComponents(), null);

wsCon.setFlowTable(flowTable, null);

One answer

permanent link
Borut Komac (111) | answered Oct 09 '15, 8:01 a.m.
edited Oct 09 '15, 8:30 a.m.
Check out this working snipet:

public void setFlowTarget(IWorkspaceConnection stream, IWorkspaceConnection flowTarget, ArrayList<ComponentWithHandle> scopeComponents, boolean isDefault, boolean isCurrent) throws TeamRepositoryException {
        IFlowTable flowTable = stream.getFlowTable().getWorkingCopy();
        flowTable.addDeliverFlow(flowTarget.getResolvedWorkspace(), teamRepository.getId(), teamRepository.getRepositoryURI(), null, flowTarget.getDescription());        
        flowTable.addAcceptFlow(flowTarget.getResolvedWorkspace(), teamRepository.getId(), teamRepository.getRepositoryURI(), null, flowTarget.getDescription());    
        IFlowEntry flowNodeDeliver = flowTable.getDeliverFlow(flowTarget.getResolvedWorkspace());
        IFlowEntry flowNodeAccept = flowTable.getAcceptFlow(flowTarget.getResolvedWorkspace());
        flowTable.setComponentScopes(flowNodeAccept.getFlowNode(), repackComponents(scopeComponents));    

if (isDefault) {
        if (isCurrent) {
        stream.setFlowTable(flowTable, progressMonitor);

Your answer

Register or to post your answer.