How to fetch the baseline to which changeset belongs using rtc plain java api's?
![](http://jazz.net/_images/myphoto/1fd9c8970381a26dafdc9a6af401e3ac.jpg)
2 answers
![](http://jazz.net/_images/myphoto/1fd9c8970381a26dafdc9a6af401e3ac.jpg)
Maybe this code snippet can help you.
I wrote it with server-side java API (it is in a participant), but you can try to adapt it to plain java API.
Once you have a change set, you can check whether it is part of a given baseline using the changeSetsInBaseline method of the IScmService package.
IChangeSetHandle[] csHandleInBaseline = scmService.changeSetsInBaseline(baselineHandle, csHandle, repositoryProgressMonitorHandle);
The method returns an array of change sets that has either 0 (if the change set is not part of the baseline) ot 1 (if the change set is part of the baseline) length.
Check that this way:
int matchLength = csHandleInBaseline.length;
I have not found, so far, a method that returns the baselines of which a change set is part, so I had to retrieve a list of baselines (e.g. on a stream) and iterate over it.
![](http://jazz.net/_images/myphoto/1fd9c8970381a26dafdc9a6af401e3ac.jpg)
Hi,
please consider the RTC SCM Model as described in https://jazz.net/library/article/126
A changeset belongs to a component, but it can be part of several baselines (i.e. on different streams containing that component). You can verify by using the RTC Eclipse client and looking at context menu of a changeset - what you get offered is the Locate Change Set wizard that will you allow to see of which snapshots, baselines, work item queries etc. the change set is a part.
So you can fetch the component of a changeset. From the component you can determine the baseline list. You can query for "interesting" baselines and determine whether the change set is a part of them.
So you can fetch the component of a changeset. From the component you can determine the baseline list. You can query for "interesting" baselines and determine whether the change set is a part of them.
It might be easier if you could describe the underlying use case: what do you want to achieve with the information work item --> change set --> baseline?
gg,
Arne