It's all about the answers!

Ask a question

Java API to fetch baselines of a component w.r.t to a perticular stream.


Swapnil Sahu (1317) | asked Nov 02 '17, 3:03 a.m.
edited Nov 02 '17, 4:05 a.m.

Hello,

I need to fetch only those baseline details of a component which are part of a particular stream. In the below code I am getting complete set of baselines history for a component which is shared among different streams.
I want to limit the result by filtering it by stream name.

workspaceManager.findBaselines(IBaselineSearchCriteria.FACTORY.newInstance().setComponentRequired(component), Integer.MAX_VALUE, newChild);

Requesting you to please provide plain Java API to achieve this.

Regards,
Swapnil

One answer



permanent link
Ulf Arne Bister (1.3k413) | answered Nov 02 '17, 5:24 a.m.

Reverse your thinking: the component has no idea where its change sets and baselines are being used. The stream does.

Obtain the Stream handle (basically IFlowNodeConnection ; it is the same object for a Workspace).
Then call IFlowNodeConnection#getComponents , iterate over result until you find the component handle you are looking for. Use that handle as input for:
IFlowNodeConnection#getBaselinesInHistory(IComponentHandle component , int max, IProgressMonitor monitor )

Look at the returned IHistoricBaselineIterator in the SDK doc to see how you can getBaselines and use hasPrevious and getPrevious to get the whole list of baselines this component has in this stream.

If this answers your question please mark it as accepted.
- Arne


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.