It's all about the answers!

Ask a question

Creating CLM links from a workitem save participant


Simon Fisher (1631710) | asked Nov 25 '11, 4:32 a.m.
JAZZ DEVELOPER
Hi,

What's the best way to programmatically link to RQM (a test case) from a work item save participant? Are there internal RTC APIs for this or do OSLC calls have to be made from the participant Java code?

Is it even possible?

Thanks,

Simon

Accepted answer


permanent link
Ralph Schoon (63.1k33645) | answered Jul 17 '12, 5:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jul 17 '12, 6:12 a.m.
Simon, a bit late.....

I stumbled across this some time ago. This should be working similar in a participant. The code below is client code, I highlighted the important part. You call it with a URI to the remote object. See https://jazz.net/forum/questions/81826/how-an-operation-participant-works?page=1&focusedAnswerId=81979#81979 on how to save a work item in a participant.

    private static class LinkURIOperation extends WorkItemOperation {

       
        private URI fURI;
        private IEndPointDescriptor fEndpointDescriptor;
       
        public LinkURIOperation( IEndPointDescriptor endpointDescriptor,URI uri) {
            super("Linking URL", IWorkItem.FULL_PROFILE);
            fURI = uri;
            fEndpointDescriptor=endpointDescriptor;
        }

        @Override
        protected void execute(WorkItemWorkingCopy workingCopy,
                IProgressMonitor monitor) throws TeamRepositoryException {
            IReference reference;
                reference = IReferenceFactory.INSTANCE.createReferenceFromURI(fURI);
                workingCopy.getReferences().add(fEndpointDescriptor,reference);
        }
    }


To call it

                    URI uri=new URI("https://clm.example.com:9448/qm/oslc_qm/contexts/_Lm2UIACBEeGZqMjM3RLKTw/resources/com.ibm.rqm.planning.VersionedTestCase/_dJzNgQCBEeGZqMjM3RLKTw");
                    IEndPointDescriptor endpoint = ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.TESTED_BY_TEST_CASE).getTargetEndPointDescriptor();
                    LinkURIOperation linkOp = new LinkURIOperation(endpoint,uri);
                    linkOp.run(workItem, monitor);

//                    IEndPointDescriptor endpoint1 = //ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.AFFECTS_EXECUTION_RESULT).getTargetEndPointDescriptor();
//                    IEndPointDescriptor endpoint3 = //ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.AFFECTED_BY_DEFECT).getTargetEndPointDescriptor();


Simon Fisher selected this answer as the correct answer

One other answer



permanent link
Simon Fisher (1631710) | answered Jul 17 '12, 12:18 p.m.
JAZZ DEVELOPER
Thanks Ralph, I did use something similar in the end.

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.