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

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

 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.

0 votes


Accepted answer

Permanent link
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

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,938
× 411
× 36

Question asked: Apr 29 '16, 3:51 p.m.

Question was seen: 3,418 times

Last updated: May 18 '16, 10:18 a.m.

Confirmation Cancel Confirm