Getting the stream to which the changesets are flowing in currently

One answer

It sounds like you just want the reference to the IWorkspaceConnection for the stream. If you are looking for the workspace's flow target, you can get it through the flow table.
workspace.getFlowTable().getCurrentDeliverFlow()
The workspace is your repository workspace that is currently flowing with stream 2.
Your current method of performing a workspace search would likely return all 3 streams if they are all owned by the same project area. Setting the sort to the oldest first is also unreliable as the criteria isn't documented so I don't know what the resulting order would be or how you would want to determine which result is the stream you want.
workspace.getFlowTable().getCurrentDeliverFlow()
The workspace is your repository workspace that is currently flowing with stream 2.
Your current method of performing a workspace search would likely return all 3 streams if they are all owned by the same project area. Setting the sort to the oldest first is also unreliable as the criteria isn't documented so I don't know what the resulting order would be or how you would want to determine which result is the stream you want.
Comments

To expand on my answer, the current deliver flow from the flow table would give you the flow entry. You'll have to get the flow node from the entry, which would be your IWorkspaceHandle for the stream.

So getCurrentDeliverFlow() for stream 2 would give a not null value and for stream 1 and stream 3, it would be null as the latest deliver flow is to stream2. Is my understanding correct?

Now, I'm not sure if I've understood your question. #getCurrentDeliverFlow() returns one flow entry representing the flow target. There cannot be more than one current flow target.
Comments
Tim Mok
JAZZ DEVELOPER May 27 '13, 9:33 a.m.Can you clarify what you mean by change sets flowing in a project area? Change sets don't flow in a project area. You can have flow targets on streams and repository workspaces and that shows intent to deliver/accept changes to/from other streams and repository workspaces.
Anjaly Bastian
May 27 '13, 10:44 p.m.I have created 3 streams, say stream 1, stream 2, stream 3. stream 3 would be my latest created stream. But in my repository workspace I have given stream 2 as flow target.Using RTC SDK how would I read stream 2, i.e the stream where my latest components would be available.I tried the below search criteria:-
final IWorkspaceSearchCriteria workspaceSearchCriteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
workspaceSearchCriteria.setKind( IWorkspaceSearchCriteria.STREAMS ); workspaceSearchCriteria.setOldestFirst( true workspaceSearchCriteria.setExactOwnerName( projectName );.
But this returns stream 3. What should be the search criteria when i want to read the stream to which currently the flow is going in.