It's all about the answers!

Ask a question

How to get the corresponding stream of a known workspace?

Stephen Lai (134) | asked May 20 '15, 2:00 a.m.
 Hi, now I have the UUID of the build workspace, how can I get its flow target stream?

One answer

permanent link
SEC Servizi (97123257) | answered May 20 '15, 4:11 a.m.
edited May 20 '15, 4:18 a.m.
First, you have to retrieve the IWorkspace object for the build workspace from the UUID param:
UUID uuid = ...
IWorkspaceHandle wksH = IWorkspace.ITEM_TYPE.createItemHandle(uuid, null);
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
IWorkspace wks = itemService.fetchItem(wksH, IRepositoryItemService.COMPLETE);
Then, you can retrieve the flows from that workspace:
List<FlowEntry> flows = ((Workspace) wks).getFlows(); 
Notice you have to cast the IWorkspace object to a Workspace object to invoke the getFlows() method.
Finally, you will have to filter that list to get only the deliver targets:
if ((flow.getFlags() & FlowFlags.DELIVER) != 0) {
    // ...

Stephen Lai commented May 20 '15, 4:55 a.m.

Thanks a lot for your solution, it works properly for me!

Your answer

Register or to post your answer.