It's all about the answers!

Ask a question

Setting FlowTarget while creating workspace


Yung-Hsiang Chan (34913) | asked Oct 21 '14, 9:43 p.m.
edited Oct 21 '14, 9:46 p.m.
Hi, I want to create a new Workspace Repository which flow with only one  component.
I tried to use the following code.
                IWorkspace iWorkspace = null;
try {
IFlowTable iFlowTable = iWorkspaceConnection.getFlowTable();
IFlowEntry iFlowEntry = iFlowTable.getDefaultDeliverFlow();
iFlowTable.setComponentScopes(iFlowEntry.getFlowNode(),
iComponentHandles);
iWorkspace = iWorkspaceConnection.getResolvedWorkspace();
} catch (Exception e) {
System.out.println(e.getMessage());
}

The iComponentHandles is a  List<ICompooentHanlde> which has only one desired IComponent.
But I will get IllegalStateException after executing iFlowTable.setComponentScopes(iFlowEntry.getFlowNode().
iComponentHandles);

How can I solve this? thanks!


3 answers



permanent link
Yung-Hsiang Chan (34913) | answered Oct 22 '14, 8:57 p.m.
Thanks for applying!

I've solved this problem by simply adding 

iWorkspaceConnection.setFlowTable(iFlowTable, monitor);

I've tried using workspace.applyComponentOperations(operation, monitor); but the component I want to add is already in this workspace. So it will fail.

And finally  I found the problem is that iFlowTable.getComponentScopes() will return empty by default. But it means it will flow with all the components.(doc: empty list means unscoped (i.e. process all components))

Thank you for your help!

permanent link
sam detweiler (12.5k6195201) | answered Oct 22 '14, 8:24 a.m.
hm.. I got an email with an additional comment you made..

iFlowTable.setComponentScopes(iFlowEntry.getFlowNode(),
iComponentHandles);

limits which of the workspace components will flow across this flow connection.
it does NOT set the components in this workspace

that is done with
workspace.applyComponentOperations(operation, monitor);

operation = IFlowNodeConnection.IComponentOp

the set componentscope should fail if the component is not in this workspace.

see the javadoc for the detailed description of these plainjava apis

permanent link
sam detweiler (12.5k6195201) | answered Oct 21 '14, 10:06 p.m.
edited Oct 21 '14, 10:06 p.m.
you need to get the working copy of the flow table to modify it

        IFlowTable dest_flowtable = workspace.getFlowTable().getWorkingCopy();

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.