Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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();
            }
           
        }

1 vote



3 answers

Permanent link
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..

2 votes


Permanent link
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/

0 votes

Comments

 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.

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?

Start here:

  1. https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/
  2. https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ 

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.


Permanent link
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() + "<=");
}  

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 38
× 24
× 9
× 8
× 1

Question asked: Nov 05 '14, 5:10 a.m.

Question was seen: 9,191 times

Last updated: Apr 13 '16, 10:03 a.m.

Confirmation Cancel Confirm