Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Java API extending - create a new work item and associate with a change set

Hi,

I have code based on Snippet2.java which delivers files to a stream and creates a new change set. I want to create a new work item and associate that work item with the new change set. Snippet5.java provides an example of creating a new work item, but I need to understand how to link the work item with the change set. A brief example would help greatly

There are many related questions in the Forum, I apologize in advance if I've overlooked an earlier answer or example. Thanks!

Peter Moraza

0 votes


Accepted answer

Permanent link
You can find some examples on https://rsjazz.wordpress.com/ for example
  • https://rsjazz.wordpress.com/2012/09/20/the-rtc-workitem-server-link-api-linking-to-work-items-and-other-elements/
  • https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/

You might also want to look at https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ , https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ , https://rsjazz.wordpress.com/2013/03/14/what-apis-are-available-for-rtc-and-what-can-you-extend/ and some other posts that talk about creating and modifying work items.

Peter Moraza selected this answer as the correct answer

0 votes

Comments

Thanks Ralph for the excellent examples. I am able to create a Change Set and Work Item, and I have the following code (based on your examples) which tries to link Work Item to  Change Set. But when I open the Work Item in the Jazz GUI, the Links tab does not contain any reference to the Change Set (or anything else).


WorkItemWorkingCopy workingCopy = createWorkItem(repo, prjareahndl, monitor);
IItemType iit = cs1.getItemType();
IItemHandle iih = iit.createItemHandle(cs1.getItemId(), cs1.getStateId());
IItemReference reference = IReferenceFactory.INSTANCE.createReferenceToItem(iih);
IEndPointDescriptor endpoint = LinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.CHANGE_SET).getTargetEndPointDescriptor();
workingCopy.getReferences().add(endpoint, reference);

If I pass IItemHandle to createWorkItem method I get "InternalRepositoryException: Links of this type may only be modified by the defining component." when trying to save the IWorkItem.

I had not saved the WorkItemWorkingCopy after linking the Change Set and Work Item. After doing that and also changing WorkItemLinkType to  RELATED_CHANGE_MANAGEMENT the Link tab now contains a nice link to the Change Set. Thanks Ralph Schoon for pointing me in the right direction, and also for the instructions on configuring RTC for API development. Your articles are great!


1 vote

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937
× 411
× 369
× 149

Question asked: Aug 21 '13, 4:44 p.m.

Question was seen: 7,161 times

Last updated: Jun 09 '14, 3:15 p.m.

Confirmation Cancel Confirm