It's all about the answers!

Ask a question

RTC 6.2: Not able to fetch all the Streams in a Project using Plan Java API


Naveen Tyagi (19778152) | asked Aug 24 '16, 3:27 a.m.
edited Sep 03 '16, 11:23 p.m. by David Lafreniere (4.8k7)
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

Comments
sam detweiler commented Aug 24 '16, 7:27 a.m.

how are you doing the 'fetch all streams'?


Naveen Tyagi commented Aug 25 '16, 1:20 a.m.

 I just updated the question with  source code.


Naveen Tyagi commented Aug 25 '16, 2:14 a.m.

 I get the reason but don't know the solution. :)

If Stream is owned by a team then it is not being fetched even if the user is part of that team but able to see and can make  changes from RTC Client, in case  if team is owned by project than it is working fine for both RTC Client and API. 

Accepted answer


permanent link
sam detweiler (12.5k6195201) | answered Aug 25 '16, 7:37 a.m.
>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



permanent link
sam detweiler (12.5k6195201) | answered Aug 26 '16, 7:40 a.m.
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


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.