It's all about the answers!

Ask a question

Get component baselines in Stream/Workspace/Snapshot via RTC API


1
1
Marko Tomljenovic (3163582) | asked Jun 29 '15, 10:22 a.m.
 Hi,
can anybody point me to an API example on how to retrieve the (current) component baselines of a Stream/Workspace or Snapshot.

Thank you

Comments
Marko Tomljenovic commented Jun 30 '15, 3:09 a.m. | edited Jun 30 '15, 3:12 a.m.

 The object I have is an IWorkspace instance. Can you tell me how to come from an IWorkspace to IFlowNodeConnection?

Accepted answer


permanent link
Arne Bister (2.6k12732) | answered Jun 29 '15, 5:09 p.m.
JAZZ DEVELOPER
Marko,

I can point you to some of my examples which are client side code. I guess server side code will be similar.

Snapshot recipe:
First you need IBaselineSet snapshot;
You can get this from snapshot URL:

URI snapshotUri = URI.create(snapshotURL.replaceAll(" ", "%20"));
Location snapshotLocation = Location.location(snapshotUri);
snapshotItem = (IBaselineSet) teamRepository.itemManager()
                .fetchCompleteItem(snapshotLocation, IItemManager.DEFAULT,monitor);

Then get the baselines and resolve them permission aware:
    List<IBaselineHandle> snapBaseList = snapshot.getBaselines();
    IFetchResult fetchResult = teamRepository.itemManager().fetchCompleteItemsPermissionAware(snapBaseList, IItemManager.DEFAULT, null);

Stream / Workspace:
They are both of class IFlowNodeConnection. This has a method
IFlowNodeConnection myStream = ... ;
List<IBaselineSetHandle> baselineSetHandles = myStream.getBaselineSets(monitor);

which returns the snapshots. Get latest snapshot and proceed as with Snapshot recipe.

If this answers your question please mark it as accepted.

- Arne

Marko Tomljenovic selected this answer as the correct answer

Comments
Marko Tomljenovic commented Jun 30 '15, 3:13 a.m.

  The object I have is an IWorkspace instance. Can you tell me how to come from an IWorkspace to IFlowNodeConnection?


Arne Bister commented Jul 01 '15, 3:59 a.m.
JAZZ DEVELOPER

IWorkspaceConnection wsConn = SCMPlatform.getWorkspaceManager(teamRepository).getWorkspaceConnection(workspaceHandle, monitor);

with com.ibm.team.scm.client.SCMPlatform

You can get the handle from IWorkspace using .getItemHandle();


Marko Tomljenovic commented Jul 01 '15, 4:51 a.m.

What if my workspace/stream has no snapshots but only contains baselined components?


Arne Bister commented Jul 01 '15, 10:36 a.m.
JAZZ DEVELOPER

Marko,
I found a better and more direct call, also for IWorkspaceConnection:

IWorkspaceConnection wsConn;
List<IComponentHandle> compList = wsConn.getComponents();
for (IComponentHandle compHandle : compList) {
        IBaselineHandle blHandle = wsConn.getComponentInfo(compHandle).basis();
}

This example is client side code. Do you need this or are you trying to code server side?


Marko Tomljenovic commented Jul 01 '15, 10:59 a.m.

Hi Arne,

Now everything works fine.

But I have to admit the API is so damn complex that without you I would never have reached my goal.

Thank you

Your answer


Register or to post your answer.