How to get all Streams under a projectArea with java plain api
Hi,
I want to get all streams under a project area. Now I get IProjectArea object and IProjectAreaHandle through the code as follows:
ITeamRepository repository = openRepositoryConnection();
IProcessClientService processClientService = (IProcessClientService)repository.getClientLibrary(IProcessClientService.class);
URI uri = URI.create(URIUtil.encodePath(projectAreaName));
IProcessArea processArea = processClientService.findProcessArea(uri, null, null);
if (processArea instanceof IProjectArea){
IProjectArea projectArea = (IProjectArea) processArea;
IProjectAreaHandle projectAreaHandle = projectArea.getProjectArea();
}
}
|
3 answers
I use this in one of my plain java applications
after the search for Streams, I then test to see if the stream process area matches the project area final IWorkspaceManager srcmgr = SCMPlatform.getWorkspaceManager(srcrepo); IWorkspaceSearchCriteria srcstreamsearchcriteria = IWorkspaceSearchCriteria.FACTORY.newInstance(); srcstreamsearchcriteria.setKind(IWorkspaceSearchCriteria.STREAMS); // loop thru all the streams on the src system for (IWorkspaceHandle iwsh : (List<IWorkspaceHandle>) srcmgr.findWorkspaces(srcstreamsearchcriteria, IWorkspaceManager.MAX_QUERY_SIZE, null)) { IWorkspaceConnection stream = srcmgr.getWorkspaceConnection(iwsh, null); if(stream.getProcessArea(null).getItemId().getUuidValue().equals(owning_project.getProjectArea().getItemId().getUuidValue()) ) { // is in this project area } you don't need the SDK for this.. |
Ralph Schoon (63.6k●3●36●47)
| answered Nov 05 '14, 5:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This post might contain what you are looking for: https://rsjazz.wordpress.com/2013/09/24/managing-workspaces-streams-and-components-using-the-plain-java-client-libraries/
Comments
Qin Zhang
commented Nov 05 '14, 5:27 a.m.
Thanks for replying.
In the given url of "Manage Streams" part, it use IWorkspaceSearchCriteria to search some special Streams according its name. But I want to get all streams under a special ProjectArea through IProjectArea object or IProjectAreaHandle object. Any thought?
I would consider search criteria such as Owner (a team or project area for a stream). sorry, that is what I know about the API and what I found for this purpose. There might be other ways, the RTC Eclipse client uses something to show all streams in the Team Artifacts view. You can search the SDK for that.
Qin Zhang
commented Nov 10 '14, 2:49 a.m.
Okay, but how to use the SDK? I downloaded RTC-SDK-4.0.6.zip from jazz server and unzip it, then got three sub folders and two jar files. How do I use them?
Ralph Schoon
commented Nov 10 '14, 2:57 a.m.
| edited Nov 10 '14, 2:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Start here:
Various posts on that site explain how to search the API in Eclipse once you have done 1 and 2. You can search the site for articles using keywords.
|
Based on Sam code, if you already know the Project Area I think you may simply add the search criteria:
srcstreamsearchcriteria.setExactOwnerName(projecAreaName);
and then cycle through the resulting Handles:
List<IWorkspaceHandle> wksHandles = wksManager.findWorkspaces(wksSearchCriteria, IWorkspaceManager.MAX_QUERY_SIZE, null);
for (IWorkspaceHandle wksHandle : wksHandles) {
IWorkspaceConnection stream = wksManager.getWorkspaceConnection(wksHandle, null);
log.trace("Stream =>" + stream.getName() + "<=");
}
|
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.