It's all about the answers!

Ask a question

How do I retrieve a user's repository workspace?


Vijayakumar B (22610) | asked Aug 06 '13, 5:01 p.m.
edited Aug 07 '13, 10:06 a.m. by Geoffrey Clemm (30.1k33035)

Can any one suggest me, how we can retrieve the user's repository using plain java api.

All the materials i went through provides solution to fetch the stream/workspace inside the Project area. but i have a requirement which needs me to fetch the users repository workspace. so i can get the flow target of the user repository and enable or disable actions based on the flow target.

Thanks in advance.

Accepted answer


permanent link
SEC Servizi (97123860) | answered Aug 07 '13, 5:17 a.m.
If you know the name of the repository workspace:
String workspaceName = ...
you can find it as:
ITeamRepository repo = ...
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
criteria.setKind(IWorkspaceSearchCriteria.WORKSPACES);
criteria.setExactName(workspaceName);
List<IWorkspaceHandle> workspaces = SCMPlatform.getWorkspaceManager(repo).findWorkspaces(criteria, IWorkspaceManager.MAX_QUERY_SIZE , null);
IWorkspaceHandle wksH = workspaces.get(0);
Cheers.
Vijayakumar B selected this answer as the correct answer

Comments
Vijayakumar B commented Aug 08 '13, 12:46 p.m.

Thanks a lot Servizi. now i understand the difference between WORKSPACE and STREAM, thought there are not much difference between them, WORKSPACEs represent the users repository and STREAMs to the Project Area repository.

Hope i got it right..!!!

Your answer


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