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

Linking in ALM

Hello All,

I am working on creating links and backlinks for workitems across servers.

I have written the following code :

Add a link :
private void addLink(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor, IWorkItem sourceWorkItem) throws TeamRepositoryException {
            IReference targetEndpoint = getTargetEndPoint((ITeamRepository) sourceWorkItem.getOrigin(),
                    sourceWorkItem.getId());
            workingCopy.getReferences().add(fIEndPointDescriptor, targetEndpoint);
            workingCopy.save(monitor);
        }


private IReference getTargetEndPoint(ITeamRepository teamRepo, int workItemID) throws TeamRepositoryException {
            IWorkItemClient workItemClient = (IWorkItemClient) (teamRepo).getClientLibrary(IWorkItemClient.class);

            URI myURI = ItemURI.createWorkItemURI(workItemClient.getAuditableCommon(), workItemID);
            Location location = Location.location(myURI);
            IReference targetEndpoint = IReferenceFactory.INSTANCE.createReferenceFromURI(location.toAbsoluteUri());
            return targetEndpoint;
        }


Add a backlink :

private void addBackLink(IWorkItem targetWorkItem, IProgressMonitor monitor) throws TeamRepositoryException {

            WorkItemWorkingCopy workingCopy = getSourceWorkingCopy();
            IReference targetEndpoint = getTargetEndPoint((ITeamRepository) workItem.getOrigin(), targetWorkItem.getId());
            workingCopy.getReferences().add(getRequiredBackLink(), targetEndpoint);
            workingCopy.save(monitor);
        }

getSourceWorkingCopy() method gives me the source work item workingcopy and getRequiredBackLink() returns a backlink. For E.g. if link is tracks then getRequiredBackLink() will return Contributes To.

THIS CODE WORKS FOR ME IF THE WORK ITEMS ARE IN THE SAME SERVER: BUT IT DOESN'T WORK ACROSS SERVERS.
Any other suggestions ?
Thanks for the help in advance.

0 votes

Comments

If you are working across servers, there are a local server (where your code runs) and a remote server. I don't think you can use plain Java API to manipulate work items on the remote server. You need to use API over HTTP (OSLC, internal REST and etc).



One answer

Permanent link
Creating back links works in a different way.  See https://rsjazz.wordpress.com/2013/11/06/creating-clm-links-with-back-link/

Where and how back links are stored changes in RTC 6.x as well.


I haven't tried to link across CCM repository borders, but I have linked to QM and RM elements and that is across repo and works. Unfortunately the question does not provide much useful symptoms what goes wrong.

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
× 1,221
× 411

Question asked: Jul 11 '16, 8:56 a.m.

Question was seen: 2,345 times

Last updated: Jul 12 '16, 2:46 a.m.

Confirmation Cancel Confirm