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

RTC API to Retrieve appropriate baseline from snapshot and extract files

 Hello,


I have a stream that has 4 components (A,B,C,D). What I understand is when I create a snapshot, baselines for all 4 components will be available in the snapshot. I was able to get the API to extract all SNapshots of my stream. But when I select one snapshot, how do I get to the baseline of required component?
What I want to achieve is extract files of the required baseline in the snapshot and copy them to another component.
Any help in this direction will be really appreciated. Thanks!

0 votes

Comments

As a general rule, branching and merging is good, copying is bad.   There are of course exceptions, so just for interest's sake, what is the use case that is forcing you to copy files from one component to another? 

 Test Stream, Development Stream, Integration Stream --- A Snapshot gets created in Dev stream which has multiple baselines...only one component baseline data is required to take it to Integration Stream... I have been asked to develop a UI that makes the user select the Stream ---one snapshot within it ---- one or multiple component baselines within it and copy the content in it to the Stream->Component the user selects in the UI.

The question was "why are they copying files between different components". 


Accepted answer

Permanent link

When you have a snapshot (IBaselineSet) you will need to fetch the full IBaseline objects (from the handles of IBaselineSet.getBaselines()). From there, you can get the component using IBaseline.getComponent().

V D selected this answer as the correct answer

0 votes

Comments
Thanks David. I am relatively new to this.
I was able to get the baseline component handle...

List<IBaselineHandle> baselineHandlez = snapshot.getBaselines();

List<IBaseline> baselinez = repoConnection.itemManager().fetchCompleteItems(baselineHandlez, IItemManager.DEFAULT, monitor);
 
IBaseline b1 = baselinez.get(i);
IComponentHandle c1 = b1.getComponent();
IComponent c1my = (IComponent) repoConnection.itemManager().fetchCompleteItem(c1, IItemManager.DEFAULT, monitor);
c1my.getName()

now I need to copy the code in this component baseline to another component... 

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

Question asked: Feb 01 '21, 1:10 a.m.

Question was seen: 986 times

Last updated: Feb 08 '21, 1:04 p.m.

Confirmation Cancel Confirm