It's all about the answers!

Ask a question

RTC API to Retrieve appropriate baseline from snapshot and extract files

V D (133) | asked Feb 01 '21, 1:10 a.m.


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!

Geoffrey Clemm commented Feb 05 '21, 11:32 a.m.

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? 

V D commented Feb 08 '21, 12:19 p.m.

 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.

Geoffrey Clemm commented Feb 08 '21, 1:04 p.m.

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

Accepted answer

permanent link
David Lafreniere (4.8k7) | answered Feb 01 '21, 7:30 a.m.

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

V D commented Feb 05 '21, 6:30 a.m.
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);

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

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.