It's all about the answers!

Ask a question

RTC Plain Java API: Having IWorkspace and IComponent, need IBaseline of IComponent as it is in IWorkspace


Martin Muellenberg (7259) | asked Oct 24 '13, 7:00 a.m.
retagged Dec 16 '13, 1:27 p.m. by David Lafreniere (4.8k7)
Hello all,

I use the RTC Plain Java API 4.0.4. I have an IWorkspace and an IComponent (which is a direct child of the IWorkspace). How to get the IBaseline of the IComponent as it is contained in the IWorkspace?

I don't want all IBaselines of the IComponent as I then do not know which of the IBaselines is the one in IWorkspace.

Any hint is highly appreaciated.

Kind regards and thanks
Martin Muellenberg

Accepted answer


permanent link
Nick Edgar (6.5k711) | answered Oct 25 '13, 4:05 p.m.
JAZZ DEVELOPER
Hi Martin, try importing:
com.ibm.team.scm.client.SCMPlatform
com.ibm.team.scm.client.IWorkspaceConnection

and using:
ITeamRepository repo = ...
IWorkspace workspace = ...  // or just IWorkspaceHandle
IComponent component = ... // or just IComponentHandle
IProgressMonitor pm = null; // should really use a proper one
IWorkspaceConnection conn = SCMPlatform.getWorkspaceManager(repo).getWorkspaceConnection(workspace, pm);
int max = 10;
IHistoricBaselineIterator iter = conn.getBaselinesInHistory(component, max, pm)

where IHistoricBaselineIterator is kind of a page iterator, with methods getBaselines() (their handles), hasPrevious(), and getPrevious(...).

Martin Muellenberg selected this answer as the correct answer

Comments
Nick Edgar commented Oct 25 '13, 4:06 p.m.
JAZZ DEVELOPER

If you want to get snapshots (aka baseline sets) instead, use:

conn.getBaselineSets(pm)


Martin Muellenberg commented Oct 26 '13, 5:43 a.m.

Hello Nick,

Thank you very much for your reply. This looks like what I was looking for. I will check that out on Monday when I am back in the office.

Kind regards
Martin Muellenberg

One other answer



permanent link
Stefano Antoniazzi (1701711) | answered May 24 '16, 8:28 a.m.
edited May 25 '16, 10:56 a.m.
Just to point out that com.ibm.team.scm.client.IFlowNodeConnection.getBaselinesInHistory(IComponentHandle, int, IProgressMonitor) returns baselines that "... are considered to be part of this workspace's history if this workspace's change history is built explicitly on top of previous baselines. In the very least, this result should include the component's initial baseline...". 

So if you're searching instead a list of the specific stream or workspace component baselines (like what you get from ui when you right click on the component of a workspace and then you select show > baselines) you've to follow a different path, for example this link just changing for example from
wsConn.getComponentAuditTrail(compHandle, numBasisInHistory - 1, 1, new NullProgressMonitor());
to
long numBasisInHistory = currentComponentInfo.numBasisInHistory();

wsConn.getComponentAuditTrail(compHandle, 0, numBasisInHistory , new NullProgressMonitor());

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.