It's all about the answers!

Ask a question

Are there APIs to list all Streams in a project area?

Susan Hanson (1.6k2201194) | asked Mar 27 '15, 1:57 p.m.
 I do quite a few programmatic things with work items, but I don't see any APIs specifically to allow me to get a list of all Streams in a project area.  Does anyone have a pointer or snippet?

One answer

permanent link
sam detweiler (12.5k6195201) | answered Mar 28 '15, 8:02 a.m.
what I use (plain java )
final IWorkspaceManager mgr = SCMPlatform.getWorkspaceManager(repo);
// get the list of streams
            IWorkspaceSearchCriteria streamsearchcriteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
            // loop thru all the streams on the src system
            for (IWorkspaceHandle iwsh : (List<IWorkspaceHandle>) mgr.findWorkspaces(streamsearchcriteria, IWorkspaceManager.MAX_QUERY_SIZE, null))
                IWorkspaceConnection stream = mgr.getWorkspaceConnection(iwsh, null);

                // if this workspace is a stream
                if (stream.isStream()
                // AND it is in the same process area as the seleted project
                        && stream.getProcessArea(null).getItemId().getUuidValue().equals(owning_project.getProjectArea().getItemId().getUuidValue())

Your answer

Register or to post your answer.