RTC 6.2: Not able to fetch all the Streams in a Project using Plan Java API
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
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
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
}
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
}
Comments
sam detweiler
Aug 24 '16, 7:27 a.m.how are you doing the 'fetch all streams'?
Naveen Tyagi
Aug 25 '16, 1:20 a.m.I just updated the question with source code.
Naveen Tyagi
Aug 25 '16, 2:14 a.m.I get the reason but don't know the solution. :)