It's all about the answers!

Ask a question

Linking in ALM


Sudipto Sarkar (631243) | asked Jul 11 '16, 8:56 a.m.
edited Jul 11 '16, 8:13 p.m. by Donald Nong (14.5k414)
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.

Comments
Donald Nong commented Jul 11 '16, 8:15 p.m.

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
Ralph Schoon (63.1k33645) | answered Jul 12 '16, 2:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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.

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.