It's all about the answers!

Ask a question

Is AFFECTED BY DEFECT link type duplicated?


1
1
Manuel Felipe Amaya (1321527) | asked Jul 30 '15, 2:21 p.m.
edited Jul 30 '15, 2:27 p.m.
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



permanent link
Donald Nong (14.5k614) | answered Aug 03 '15, 10:54 p.m.
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/

permanent link
Manuel Felipe Amaya (1321527) | answered Aug 05 '15, 12:47 p.m.
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.
  • linkTypeMaps is a map that contains the link identifier and the IEndPointDescriptor as shown in the line below.
linkTypeMaps.put("AFFECTED_BY_DEFECT", ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.AFFECTED_BY_DEFECT).getTargetEndPointDescriptor());
  • backlinkgs is another map that contains the link identifier mapped to the link dentifier of the backlink:
backLinkTypeMaps.put("AFFECTED_BY_DEFECT", "AFFECTS_PLAN_ITEM");

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);
    }

permanent link
Ralph Schoon (63.6k33646) | 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


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