It's all about the answers!

Ask a question

I can view build results using the RTC eclipse client, but not with browser

K M (38325051) | asked Nov 19 '13, 2:37 p.m.
retagged Dec 16 '13, 1:13 p.m. by David Lafreniere (4.8k7)
I create build results using the java api, I can view the results using the eclipse client but not with the browser
I get he result title but nothing else, no error is reported in the browser.

When I hover on the build result in the browser, the result's information appears.

K M commented Nov 22 '13, 12:35 p.m. | edited Nov 26 '13, 3:59 p.m.

when I use the eclipse gui, it reports the build result has no start request. Can this be the problem?

Is their any way of debuging this problem?

K M commented Nov 25 '13, 4:49 p.m. | edited Nov 26 '13, 4:00 p.m.

If I add a IBuildRequest buildRequest, I can now see most of the the build results

All except workitems associated with the results.

K M commented Nov 26 '13, 2:35 p.m. | edited Nov 26 '13, 4:00 p.m.

I add the work items to the result using

        contribution = BuildItemFactory.createBuildResultContribution();
        if ((handleIds != null) && (handleIds.length != 0)) {
            contribution.setExtendedContributionData(ContentUtil.stringArrayToContent(repo, handleIds,'\n'));
        result = buildClient.addBuildResultContribution(result, contribution,IBuildResult.PROPERTIES_COMPLETE, null);       

I do not link the work item to the build result

2 answers

permanent link
Nick Edgar (6.5k711) | answered Nov 26 '13, 3:56 p.m.
edited Nov 26 '13, 3:59 p.m.
Hi K.  The "included in build" links have a dual representation:
(1) a contribution to the build, as you're creating in the code above
(2) item links (ILink) between the build result and work item, of type  ""

See code in[], IBuildResult, ITeamRepository) for how (2) is done.

In the Eclipse UI, the build result gets the work items referenced from the build using (1) but in the web UI it uses (2).  The links are also needed to see the referencing build(s) from work items, which don't know about build result contributions.

K M commented Nov 26 '13, 6:39 p.m.

I did see that in one of the examples, but      does not exists in
RTC 3 java api I can not import it.

I have the same problem with 

Is their a diffferent way, or am I missing something in the SDK

K M commented Nov 26 '13, 6:45 p.m.

I also can not find them in the java api doc

Nick Edgar commented Nov 27 '13, 10:44 a.m.

Sorry, that code is in the plugin, which is in the 4.x SDK but was omitted from the 3.x SDK.  See next answer for the relevant code. 

permanent link
Nick Edgar (6.5k711) | answered Nov 27 '13, 10:45 a.m.

Here's the code I mentioned above.

    private void tagWorkItems(IWorkItemHandle[] workItemHandles, IBuildResult buildResult,

            ITeamRepository teamRepository) throws TeamRepositoryException {

        ILinkManager linkManager = (ILinkManager) teamRepository.getClientLibrary(ILinkManager.class);

        List unlinkedWorkItems = findUnlinkedWorkItems(workItemHandles, buildResult, linkManager);

        List links = new ArrayList();

        List workItems = teamRepository.itemManager().fetchCompleteItems(unlinkedWorkItems, IItemManager.REFRESH, null);

        for (int i = 0; i < unlinkedWorkItems.size(); ++i) {

            IWorkItemHandle workItemHandle = (IWorkItemHandle) unlinkedWorkItems.get(i);

            IWorkItem workItem = (IWorkItem) workItems.get(i);

            links.add(createLink(teamRepository, workItemHandle, workItem, buildResult));


        linkManager.saveLinks(links, null);


     private ILink createLink(ITeamRepository teamRepository, IWorkItemHandle workItemHandle, IWorkItem workItem, IBuildResult result)

            throws TeamRepositoryException {

        IBuildDefinition definition = (IBuildDefinition) teamRepository.itemManager().fetchCompleteItem(

                result.getBuildDefinition(), IItemManager.DEFAULT, null);

        IHelperType helperType = IHelperType.IRegistry.INSTANCE.getHelperType(

                LinksPackage.eINSTANCE.getReference().getName(), LinksPackage.eNS_URI);

        String sourceComment = ItemHelper.validateStringAttributeLength(definition.getId() + " " + result.getLabel(), //$NON-NLS-1$ 

                helperType, LinksPackage.eINSTANCE.getReference_Comment().getName());

        IReference source = IReferenceFactory.INSTANCE.createReferenceToItem(result, sourceComment);

        IReference target;

        if (workItem == null) {

            // work item is missing or invisible, so create a link but provide no comment

            target = IReferenceFactory.INSTANCE.createReferenceToItem(workItemHandle);

        } else {

            String targetComment = ItemHelper.validateStringAttributeLength(

                    WorkItemTextUtilities.getWorkItemText(workItem), helperType,


            target = IReferenceFactory.INSTANCE.createReferenceToItem(workItemHandle, targetComment);


        return ILinkFactory.INSTANCE.createLink(BuildLinkTypes.INCLUDED_WORK_ITEMS, source, target);


Nick Edgar commented Nov 27 '13, 10:46 a.m. | edited Nov 27 '13, 10:47 a.m.
where BuildLinkTypes.INCLUDED_WORK_ITEMS is:

public static final String INCLUDED_WORK_ITEMS = ""; //$NON-NLS-1$

A lot of the logic here has to do with shortening the comment on the work item reference if needed. If too long for the field, the save will fail.

K M commented Nov 27 '13, 1:27 p.m.

It works

just a side note if I removed a build result using the gui, it does not remove the link form the workitem
I go to the workitem and I can not remove the link using the gui

Is their no way using the gui to remove the link?

Nick Edgar commented Nov 27 '13, 1:37 p.m.

Good to hear.  Regarding the links, no there's no way to delete them. The intent is that you may still want to know which builds a work item's change sets were included in, even if the referenced build has been deleted.

Your answer

Register or to post your answer.