Obtain flow target for workspace using API
Hi,
I've been looking at this for alittle while and I've not been able to work out the flow target for a workspace. I have the following code that provides me the workspace connection:
//get connection for workspace name IWorkspaceConnection connection = workspaceManager.getWorkspaceConnection(workspace, null);
I've tried using the call getFlowTable() and then on the returned IFlowTable use the getDefaultDeliverFlow() but these just appeared to return nulls.
Does anyone know how to get the default flow target for the workspace?
Thanks
Adam
Accepted answer
That is the correct way to get the default flow target. However, null means there is no default flow target. You may want to check that the workspace has one of its flow targets set as the default.
Comments
Hi Tim,
When I open the workspace and look at the Flow Targets I can see two Flow Targets one has default and current next to it. But when I go to getFlowTable() getDefaultDeliverFlow it returns null for the getDescription() which I assume would be the name of the flow target (in this case a stream). Or do I need to do something else to the IFlowEntry to get the actual name?
Thanks
Adam
Once you have the handle to the item, you have to fetch the full item from the repository. The IFlowEntry description is not the description set in the stream/workspace editor.
IFlowEntry defaultDeliverFlow = workspaceConnection.getFlowTable().getDefaultDeliverFlow(); if (defaultDeliverFlow == null) { System.out.println("no default flow entry"); } else { IFlowNodeHandle flowNode = defaultDeliverFlow.getFlowNode(); IWorkspace fetchedFlowNode = (IWorkspace) repo.itemManager().fetchCompleteItem(flowNode, IItemManager.DEFAULT, monitor); System.out.println(fetchedFlowNode.getDescription());</pre>
1 vote