RTC 6.2: Not able to fetch all the Streams in a Project using Plan Java API
Naveen Tyagi (197●78●152)
| asked Aug 24 '16, 3:27 a.m.
edited Sep 03 '16, 11:23 p.m. by David Lafreniere (4.8k●7)
I am trying to fetch list of all steams in a project. Although it is working fine expect for the project being used in production, i am getting only one stream which is created for Exploration/Testing purpose and project contains more than 30 streams. I have added myself in the team which owns particular stream but still not able to see, Where as i am able to see and delivered in stream from Eclipse Client. What could be possible reason. Thanks in advance.
Here is my code in which repository is class level object. public List<Stream> getStreamList(String projectName) { List<Stream> streamInfoList = new ArrayList<Stream>(); final IWorkspaceManager mgr = SCMPlatform.getWorkspaceManager(repository); IWorkspaceSearchCriteria workspaceCriteria = IWorkspaceSearchCriteria.FACTORY.newInstance().setKind(IWorkspaceSearchCriteria.STREAMS); workspaceCriteria.setPartialOwnerName(projectName); List<IWorkspaceHandle> streamList; try { streamList = mgr.findWorkspaces(workspaceCriteria, Integer.MAX_VALUE, null); Stream tempStreamObj = null; for (IWorkspaceHandle iWorkspaceHandle : streamList) { IWorkspaceConnection stream= mgr.getWorkspaceConnection(iWorkspaceHandle, null); tempStreamObj = new Stream(); tempStreamObj.setStreaname(stream.getName()); streamInfoList.add(tempStreamObj); } }catch (Exception e) { e.printStackTrace(); } return streamInfoList; }//End of Method |
Accepted answer
>workspaceCriteria.setPartialOwnerName(projectName);
you asked for the ones owned by the project. Ralph Schoon selected this answer as the correct answer
Comments
Naveen Tyagi
commented Aug 26 '16, 6:35 a.m.
Agree sam but what is the criteria to get streams part of any project?. If i remove this i am getting some of the streams are not in this project?. I want list all streams i see in RTC client for any project. |
One other answer
i have a utility that copies projects, and it does streams and workspaces too..
my code does (same loop as you ) IWorkspaceConnection stream= mgr.getWorkspaceConnection(iWorkspaceHandle, null); if( stream.getProcessArea(null).getItemId().getUuidValue().equals(owning_project.getProjectArea().getItemId().getUuidValue()) ) { // proccess stream owned by this project } |
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.
Comments
how are you doing the 'fetch all streams'?
I just updated the question with source code.
I get the reason but don't know the solution. :)