RTC: Find a Stream by ProjectArea and Contributor using Java API 3 (or 5)
![]()
Javier Beneito Barquero (6●1●2)
| asked Sep 23 '14, 4:13 a.m.
edited Sep 23 '14, 4:57 a.m. by Ralph Schoon (62.3k●3●36●43)
Hello,
I'd like to find Streams using project areas and contributors as query parameters using the Java API. I'm currently working with the Java API 3.0.1.6iFix3, but soon I could use the 5.0.1 version. I've found a blog post from Ralph Schoon: "Managing Workspaces, Streams and Components Using the Plain Java Client Libraries" (http://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/) that has methods for finding Streams by using the class IWorkspaceManager, specifically, findWorkspaces with a IWorkspaceSearchCriteria. Fatla 777 asked something similar, Get Stream from ProjectArea using RTC API 4 , and I've used the code that is included in the comment that was made in Feb 22 '13, 3:00 p.m: IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repository); But it doesn't work. It returns an empty List. I've searched the Stream for printing its projectArea (actually, its process area) and the name that I've provided seems correct. Can anyone tell me if I'm providing the project area name erroneously? and how can I filter Streams by Contributor? Thank you very much, Javier. |
2 answers
![]()
Almost solved.
The code above works, but in my case (and I don't know if it's a general rule) the Stream belongs to an ItemArea, and I was using the name of the projectArea instead of the particular teamArea.
Anyway, I still miss a clear way to filter by Contributor.
What I've done is to obtain the ProcessArea that the IComponent belongs to, via IWorkspaceConnection.getOwner() (I tried with IWorkspaceConnection.getProcessArea(IProgressMonitor but it didn't return what I expected), and after fetching the complete item...
... I use the processArea's member list to verify if some of them has an ItemID that is the same of the Contributor I'm interested in.
Brute force again, but I don't know any easier way.
I accept any suggestion.
Greetings,
Javier.
|
Comments
I only know the solution I posted in https://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/ . I would suggest to search for references to the calls you are doing and try to figure out how these are used in the API.
https://rsjazz.wordpress.com/interesting-links/ also provides some links to blogs with API usage. Some SCM development colleagues post at http://thescmlounge.blogspot.de/
The 3.x and the 5.x APIs are to 99% the same, as far as I can see.