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! |
Accepted answer
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
|
2 other answers
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); Comments
Geoffrey Clemm
commented Mar 09 '15, 2:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.
|
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.
|
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.