It's all about the answers!

Ask a question

Programmatically link ChangeSet to WorkItem


Simon Fisher (1631710) | asked May 27 '09, 1:12 p.m.
JAZZ DEVELOPER
edited Feb 19 '14, 11:18 a.m. by Jennifer Cianchetta-Riordan (2512)
Hi,

I'm using the Plain Java Client to create Work Items and Change Sets. I'd like to know how to create and save a link between a WorkItem and ChangeSet.

I've had a look at some of the classes, and tried to do it using the IFilesystemWorkItemService, however a null pointer is thrown on the second statement here as fswis is null.

IFilesystemWorkItemService fswis = (IFilesystemWorkItemService)teamRepository.getClientLibrary(IFilesystemWorkItemService.class);

ILink[] links = fswis.createLink(workspace.getResolvedWorkspace(),
cs, new IWorkItemHandle[] {(IWorkItemHandle)workItem.getItemHandle()},
null);

Any help/advice would be much appreciated.

Simon

3 answers



permanent link
Jennifer Cianchetta-Riordan (2512) | answered Feb 19 '14, 11:17 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
For information about the format of the SCM command, "add work item," see http://pic.dhe.ibm.com/infocenter/clmhelp/v4r0m6/index.jsp?topic=%2Fcom.ibm.team.scm.doc%2Ftopics%2Fadd_workitem.html.

permanent link
Arne Bister (2.6k12632) | answered Apr 02 '14, 10:17 a.m.
JAZZ DEVELOPER
Tibor,

working with RTC 4.0.5 I see that IFileSystemWorkItemManager is taken from com.ibm.team.filesystem.client.workitems_3.1.400.v20130614_0105.jar which is part of my PlainJava download.

With this I am successfully able to programmatically link change sets and work items on the client side:
IFileSystemWorkItemManager fswim = (IFileSystemWorkItemManager)teamRepository.getClientLibrary(IFileSystemWorkItemManager.class);
fswim.createLink(workspaceHandle, changeSetHandle, myWIHandles, monitor);
where myWIHandles is an array over IWorkItemHandles

If this solves your programming challenge, please mark it as accepted answer.

- Arne

permanent link
Marcel Bihr, Jazz Work Item team (1.4k) | answered Jul 14 '09, 9:10 a.m.
JAZZ DEVELOPER
Hi
The creation of links can be restricted to the component that defines the link type. In that case it is Filesystem (Source Control). This means that you have to create the link using Source Control API. A starting point can be IFileSystemWorkItemManager.

Regards

Marcel
Jazz Work Item team

Your answer


Register or to post your answer.