Setting FlowTarget while creating workspace
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
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!
hm.. I got an email with an additional comment you made..
iFlowTable.setComponentScopes(iFlowEntry.getFlowNode(),
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
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