It's all about the answers!

Ask a question

Using java client api, how to get baseline from component if component is shared among streams


vikrant kamble (1323897) | asked Apr 29 '16, 3:51 p.m.
edited Apr 29 '16, 3:52 p.m.
 Hi All,
I have below scenario
Development Stream
Dev_Comp_1(4:snap_3)
Dev_Comp_2(4:snap_3)

Integration Stream
Dev_Comp_1(5:snap_4)
Dev_Comp_2(5:snap_4)

Components of streams are originally created in Development stream and then same components are added to integration stream and then baselines named snap_4 are created on each component of integration stream.

I want to fetch latest baseline of Dev_Comp_1 from Development stream. When I do it using java API it fetches snap_4 instead of snap_3.
snap_4 is latest baseline for overall component, which resides in Integration stream.
How can i fetch snap_3 as latest baseline of Dev_Comp_1 from Development stream using java client api.

I tried using ibaselinesearchcriteria, but it fetches snap_4 as latest baseline from overall component.

Is there any API from which I can fetch state of component from Development stream, so that it can fetch snap_3 as latest baseline.

Accepted answer


permanent link
David Lafreniere (4.8k7) | answered May 17 '16, 1:43 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited May 18 '16, 10:18 a.m.
Here is how you get the last baseline (known as the 'basis') of a component in a workspace or stream.


// Fetch a handle to the last baseline (basis)

ITeamRepository repo = <repo_of_the_workspace>

IWorkspaceManager manager = SCMPlatform.getWorkspaceManager(repo);

IWorkspaceHandle workspaceHandle = <this_is_the_handle_for_dev_stream>

IWorkspaceConnection wc = manager.getWorkspaceConnection(workspaceHandle , monitor);

IComponentHandle component = <this_is_the_component_you_care_about>

IBaselineHandle basisHandle = wc.getComponentInfo(component).basis();


// Fetch the full baseline

IFetchResult fetchResult =  repo.itemManager().fetchCompleteItemsPermissionAware(Collections.singletonList(basisHandle), ItemManager.DEFAULT, monitor);

IBaseline fetchedBaseline;

if (fetchResult.getRetrievedItems().size() == 1) {

   fetchedBaseline = fetchResult.getRetrievedItems().get(0);

}
Michael Valenta selected this answer as the correct answer

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.