It's all about the answers!

Ask a question

Modifying a snapshot's name


Patrick Leyman (3044) | asked Oct 01 '10, 8:35 a.m.
Hi,

I want to change the name of a snapshot that is attached as a contribution to my build result. I'm able to recover the snapshot (BaselineSet) with the code shown below, but I couldn't find a way to change it's name.

ITeamBuildClient buildClient = (ITeamBuildClient) teamRepository.getClientLibrary(ITeamBuildClient.class);
IBuildResult buildResult = getBuildResult(buildClient, teamRepository, buildResultId, monitor);
IBuildResultContribution[] contribs = ClientFactory.getTeamBuildClient(teamRepository).getBuildResultContributions(buildResult,
ScmConstants.EXTENDED_DATA_TYPE_ID_BUILD_SNAPSHOT, monitor);
if (contribs != null && contribs.length == 1) {
if (contribs[0].getExtendedContribution() instanceof IBaselineSetHandle) {
IBaselineSetHandle baseLineHandle = (IBaselineSetHandle) contribs[0].getExtendedContribution();
IBaselineSet baseline = (IBaselineSet)teamRepository.itemManager().fetchCompleteItem(baseLineHandle, 0, monitor);
...


Anyone has an idea?

Thanks in advance,
Patrick

Accepted answer


permanent link
Arne Bister (2.6k12732) | answered Jul 29 '14, 3:17 a.m.
JAZZ DEVELOPER
Patrick,

even though this question is rather old for completness sake here is the answer, duplicated in https://jazz.net/forum/questions/121007/how-do-i-change-a-snapshots-name-using-the-jazz-plan-java-api :

IWorkspaceManager wkspcMgr = (IWorkspaceManager)repo.getClientLibrary(IWorkspaceManager.class);
wkspcMgr.setName(snapshot, "NewName - " + snapshot.getName(), monitor);
Best,
Arne

Patrick Leyman selected this answer as the correct answer

Your answer


Register or to post your answer.