Is AFFECTED BY DEFECT link type duplicated?
Hi,
I'm having a problem while trying to run a for statement in a RTC extension (operation advisor) on the AFFECTED BY DEFECT link type. After some tests, I found that if the link is created programmatically is diferent from a link created in the interface. What can I do to make the extension created links the same as the ones created manually? Link to example. http://picpaste.com/pics/Capture-bHxJHWy9.1438280792.PNG |
3 answers
Can really tell from the screen shot which link was created by your code. But I guess you need to show us the details of your code to tell whether your code matches what you intend to do.
You can always check out Ralph's fantastic blog for more references. https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ |
Can really tell from the screen shot which link was created by your code. But I guess you need to show us the details of your code to tell whether your code matches what you intend to do. You can always check out Ralph's fantastic blog for more references. Hi, To understand the code, the following lines express the variables used.
With this in mind, look at the following code: private void createLink(IWorkItem sourceWorkItem, IWorkItem targetWorkItem, String link) throws TeamRepositoryException { Set additionalParams = new HashSet(); additionalParams.add(IAdditionalSaveParameters.UPDATE_BACKLINKS); IWorkItem sourceWC= (IWorkItem)sourceWorkItem.getWorkingCopy(); IWorkItemReferences sourceReferences= workIteamServer.resolveWorkItemReferences(sourceWorkItem, null); IEndPointDescriptor descriptor=(linkTypeMaps.get(getBackLink(link))!=null)? linkTypeMaps.get(getBackLink(link)): linkTypeMaps.get(link) ; sourceReferences.add(descriptor, IReferenceFactory.INSTANCE.createReferenceToItem(targetWorkItem)); workIteamServer.saveWorkItem3(sourceWC, sourceReferences, null, additionalParams); } |
Ralph Schoon (63.7k●3●36●48)
| answered Aug 06 '15, 6:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The symptoms described remind me on something I saw while creating the RTC Work Item Commandline. If you don't do it right that ans worse things can happen (e.g. you are not able to delete links int eh web UI).
1. Check the URL of links created with the UI. You will notice there are different ways the URI look like for different link types. 2. Compare your links you created to them. For example in https://rsjazz.wordpress.com/2015/02/27/a-rtc-workitem-command-line-version-2-2/ in the WorkItemHelper. I use various methods based on the data I get to create the reference an the other end point. For work item references: IReferenceFactory.INSTANCE.createReferenceToItem(item .getItemHandle()) For CLM Work Item Links (probably your case) Location location = Location.namedLocation(workItem, ((ITeamRepository) workItem.getOrigin()) .publicUriRoot()); if I get the work item and not the URI. You can download and look at the code. |
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.