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

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

1

1 vote



3 answers

Permanent link
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/

0 votes


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

0 votes


Permanent link
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.

0 votes

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,952
× 92
× 40

Question asked: Jul 30 '15, 2:21 p.m.

Question was seen: 3,997 times

Last updated: Aug 06 '15, 6:02 a.m.

Confirmation Cancel Confirm