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

Getting a user's repository workspaces under a project area using RTC Java API

Hi everyone,

I'm using the RTC Java APIs to access our Jazz server (version 4.x). Is there a way to get a list of all of a user's repository workspaces that are under a certain IProjectArea? I've been looking at the samples, and I see how to get a list of ALL the workspaces that a user made using the WorkspaceSearchCriteria methods, but I don't see an obvious way to check what project area each IWorkspace belongs to.

This seems like it should be simple, but I just can't find a way to do it. Does anyone have any suggestions?

Thanks!

0 votes


Accepted answer

Permanent link
Workspaces aren't associated with project/team areas, just the user that created them. You can make some guesses based on the components and flow targets of the workspace, however. Can you tell us a bit more about your use case?

You might be interested in com.ibm.team.scm.common.internal.IScmQueryService.findWorkspaces() . If you know the streams in the project/team area, you can use IWorkspaceSearchCriteria.setFlowFilter() to limit the set of workspaces returned to those that currently flow with each stream. If there are a lot of streams, you'll have to make lots of calls. 

If there are one or more components that are only accessible to members of the project/team area, you can use those to query for workspaces as well. Take a look at IScmQueryService.searchForWorkspacesForComponent() .
Mike Polan selected this answer as the correct answer

0 votes


2 other answers

Permanent link
here is code I use

final IWorkspaceManager wspcmgr = SCMPlatform.getWorkspaceManager(repo);
                        IWorkspaceSearchCriteria workspacesearchcriteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
                        // say we want workspaces
                        workspacesearchcriteria.setKind(IWorkspaceSearchCriteria.WORKSPACES);
                        // for THIS user
                        workspacesearchcriteria.setExactOwnerName(wkspace_owner.getName());
                        // get the list
                        List<IWorkspaceHandle> user_workspacehandles = (List<IWorkspaceHandle>) wpscmgr.findWorkspaces(workspacesearchcriteria, IWorkspaceManager.MAX_QUERY_SIZE, null);

0 votes

Comments

You will note that Sam's code never refers to a project area, because workspaces do not live in/under a project area.   The just live as global objects in the repository, but if you want to think of them as living under something, you can think of them as living under the user that owns them.


Permanent link
Thanks for the replies everyone. Indeed I was misunderstanding where the repository workspaces live, so my original use case is probably not valid. Fetching all of a user's workspaces is the approach I will go with.

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
× 457
× 235
× 89
× 85

Question asked: Mar 08 '15, 6:17 p.m.

Question was seen: 5,409 times

Last updated: Mar 12 '15, 11:52 a.m.

Confirmation Cancel Confirm