How to list the component baselines in a snapshot using Java API?
Accepted answer
With your IBaselineSet that represents the snapshot, you can call #getBaselines().
Comments
Good morning.
Incrementing the Tim's answer, try it this:
IComponentHandle componentHandle = changeSet.getComponent();
IComponent component = (IComponent) itemService.fetchItem(componentHandle, IRepositoryItemService.COMPLETE);
ServiceHistoryProvider targetHistory = ServiceHistoryProvider.FACTORY.create(workspace, changeSet.getComponent());
BaselinesInHistoryResult baselinesInHistory = scmService.getBaselinesInHistory(targetHistory, Integer.MAX_VALUE, null, null);
List<IBaselineHandle> baselines = baselinesInHistory.getBaselines();
for (IBaselineHandle baselineHandle : baselines) {
IBaseline baseline = (IBaseline) itemService.fetchItem(baselineHandle,IRepositoryItemService.COMPLETE);
<continue...>
}
-1 votes
Just to make it clear for readers: This code shows how, on the server, one would fetch the baselines in the history of some workspace or stream. The question is asking how to get the baselines of a given snapshot, which would be IBaselineSet.getBaselines().