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

How to get Stream, Component, Workspace using server api.

Hi All,


I am trying to read the Stream, component , workspace, etc using server api.
It is possible to read using server api.
Please provide useful links for accessing Stream, component , workspace, etc using server api.
It is possible to read using server api.

0 votes


Accepted answer

Permanent link

What is your starting point?

I mean, when server API are invoked in a plugin, you are performing an action.
Anyway, you can retrieve a stream, or a workspace, that has a specific name with this code:

IWorkspaceHandle workspaceHandle = null;
IScmQueryService scmQueryService = getService(IScmQueryService.class);
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
criteria.setKind(IWorkspaceSearchCriteria.ALL);
criteria.setExactName(streamName);
List<IWorkspaceHandle> workspaceHandles = scmQueryService.findWorkspaces(criteria, Integer.MAX_VALUE, repositoryProgressMonitorHandle).getItemHandles();
if (!workspaceHandles.isEmpty()) {
workspaceHandle = workspaceHandles.get(0);
}
return workspaceHandle;

If you are dealing with change sets (a typical situation during delivery or checkin), you can easily retrieve the component it belongs to:

changeSet.getComponent();

I hope that these snippets help.

Anurag Patel selected this answer as the correct answer

0 votes


One other answer

Permanent link

 Since this totally depends on what data you have available and what the server API context is, there is no reasonable way to answer. 


I have explained some of the SCM API in the posts https://rsjazz.wordpress.com/tag/scm/
Note, dependent on the post it is client or common or server API. In the server you can only use Common and Server API (look for common or server in the package name, avoid client or rcp in the package names).

Maybe there is more to answer, once you care to provide what you want to do, where and why. See: How should I ask a question in the Forum if I want to receive useful answers?


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
× 10,951

Question asked: Oct 05 '17, 7:03 a.m.

Question was seen: 1,469 times

Last updated: Oct 05 '17, 7:55 a.m.

Confirmation Cancel Confirm