It's all about the answers!

Ask a question

How do I change a snapshot's name using the Jazz Plan Java API?


Thom Savage (1112) | asked Jul 26 '13, 12:04 p.m.
I've got an IBuildResult that has a valid snapshot (IBaselineSet) associated with it. I've been able to get a handle on the snapshot by fetching it as an extended contribution. I'm using the following snippet, which throws no exceptions; however, the change does not show up when browsing the snapshot in the Eclipse client. What do I need to do to get my snapshot's name updated?
//== Mutate snapshot to match new buildLabel
IBuildResultContribution[] snapshotContribs = buildClient.getBuildResultContributions(parentBuild, new String[] { ScmConstants.EXTENDED_DATA_TYPE_ID_BUILD_SNAPSHOT}, monitor);
IWorkspaceManager wkspcMgr = (IWorkspaceManager)repo.getClientLibrary(IWorkspaceManager.class);
if(snapshotContribs != null) {
   IBaselineSetHandle bsHandle = (IBaselineSetHandle)snapshotContribs[0].getExtendedContribution();
   IBaselineSet snapshot = (IBaselineSet)itemManager.fetchCompleteItem(bsHandle, ItemManager.REFRESH, monitor);
   wkspcMgr.setName(snapshot, "NewName - " + snapshot.getName(), monitor);
}

Accepted answer


permanent link
Tim Mok (6.6k38) | answered Jul 26 '13, 3:16 p.m.
JAZZ DEVELOPER
It looks fine to me. It might be an issue of the Eclipse client using stale data. Did you try forcing a refresh of the Eclipse client (i.e. force a refresh of the view listing the snapshot or refresh the snapshot editor)?
Thom Savage selected this answer as the correct answer

Comments
Thom Savage commented Jul 26 '13, 5:54 p.m.

Though I did a number of refreshes and didn't see any changes, a cup of coffee and a re-visit in the afternoon revealed that the save did go through and the world is right. Thanks!

Your answer


Register or to post your answer.