It's all about the answers!

Ask a question

Obtain flow target for workspace using API


Adam Coulthard (1322116) | asked May 17 '13, 9:03 a.m.
 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


permanent link
Tim Mok (6.6k38) | answered May 17 '13, 10:05 a.m.
JAZZ DEVELOPER
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.
Adam Coulthard selected this answer as the correct answer

Comments
Adam Coulthard commented May 17 '13, 10:12 a.m.

 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


1
Tim Mok commented May 17 '13, 10:29 a.m.
JAZZ DEVELOPER

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>

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.