It's all about the answers!

Ask a question

How to retrieve file path for IVersionable from IChangeSet with IBaselineSet, Workspace given?


Arne Bister (2.6k12832) | asked Aug 15 '14, 8:45 a.m.
JAZZ DEVELOPER
edited Aug 15 '14, 8:46 a.m.
Given:
ISnapshotHandle snapshot1, snapshot2

temp Workspace created from that: IWorkspaceConnection tempWSConnection = SCMPlatform                    .getWorkspaceManager(teamRepository).createWorkspace(currentUser,name, comment, snapshot1, null);

List <IChangeSetHandle> changeSetList retrieved from:
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(teamRepository);
IChangeHistorySyncReport changeSync = workspaceManager.compareBaselineSets(snapshot1, snapshot2, null, null);
changeSetList = changeSync.outgoingChangeSets();

Looking for:
the easiest way to resolve the file name of the IVersionables in each ChangeSet of ChangeSetList in the context of the Workspace
Currently I iterate over the IVersionableHandles and do:
IFileItem file = (IFileItem) workspace.configuration(component).fetchCompleteItem(versionableHandle, monitor);
String fileName = file.getName();

Notice that for this I need the component for the ChangeSet in that particular workspace. Can I get this information in the case above where I retrieve Change Sets as a diff between two snapshots (compareBaselineSets) ?

Or is there a way to resolve the file name directly just by knowing workspace, change set, snapshot?

Accepted answer


permanent link
Tim Mok (6.6k38) | answered Aug 15 '14, 9:14 a.m.
JAZZ DEVELOPER
You'll still need the component. Since you have the change sets, you can retrieve the component from it.
Arne Bister selected this answer as the correct answer

Comments
Arne Bister commented Aug 15 '14, 9:21 a.m.
JAZZ DEVELOPER

groan Ach, of course. Grand oversight of my part, of course there is
IChangeSet#getComponent

Ok, makes sense. I will always need the Component for context because that is where the change set "lives".

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.