It's all about the answers!

Ask a question

RTC how to register my custom link type


Stefania Axo (12621513) | asked Apr 17 '13, 1:25 p.m.
edited Apr 17 '13, 2:05 p.m.
RTC 4.0.2
I have a custom link type.
I want to retrieve it via code the work item that has that specific custom link type.
I have some code that was suppose to do the retrieve of the link of my link type....that but it does not work. Not sure if it is stopped to work with RTC 4.0.2 or 4.0.1...

Anyway I debug the code and it seems that the links are there but then another method that call all the link will remove the link type that are not registered.
How do i register a custom link type?


&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
      ILinkQueryPage linkQueryPage = linkServiceLibrary.findLinksBySource(
            new String[] { linkTypeId },
            new IReference[] { workItemReference } );
      ILinkCollection linkCollection = linkQueryPage.getAllLinksFromHereOn();
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
linkQueryPage contains my new type linked work items but linkQueryPage.getAllLinksFromHereOn();
wipes them out because .getAllLinksFromHereOn(); remove the unregistered link type.


thanks
Stefania


here is the RTC API called from getAllLinksFromHereOn()
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
com.ibm.team.links.common.internal.LinkQueryPage.getAllLinksFromHereOn()
    public ILinkCollection getAllLinksFromHereOn() {
        return new LinkCollection(contents);
    }

com.ibm.team.links.common.internal.LinkCollection.LinkCollection(Collection<ILink>)

    public LinkCollection(Collection<ILink> c) {
        super();
        list = removeUnknownLinks(c == null ? new ArrayList<ILink>() : c);
    }

com.ibm.team.links.common.internal.LinkCollection.removeUnknownLinks(Collection<ILink>)

    private Collection<ILink> removeUnknownLinks(Collection<ILink> allLinks) {
        // TODO: While iterating, the hashmap by name can also be created
        List<ILink> knownLinks = new ArrayList<ILink>();
        if (allLinks == null)
            return knownLinks;
        for (ILink link : allLinks) {
            if (ILinkTypeRegistry.INSTANCE.isRegistered(link.getLinkTypeId()))
                knownLinks.add(link);
        }
        return knownLinks;
    }
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
my links are removed because they are not registered!


Accepted answer


permanent link
Stefania Axo (12621513) | answered Apr 17 '13, 7:41 p.m.
i found the problem
it was in the plugin.xml.
there was a space in the iitemTypeName="WorkItem " of the source endpoint.

thank you
Stefania
Ralph Schoon selected this answer as the correct answer

2 other answers



permanent link
sam detweiler (12.5k6195201) | answered Apr 17 '13, 6:36 p.m.
you installed the plugin on the server and the client, right?
and restarted both, cold to force reload.

permanent link
sam detweiler (12.5k6195201) | answered Apr 18 '13, 1:53 p.m.
dang computers.. so accurate!

Comments
Kevin Ramer commented Apr 18 '13, 1:55 p.m.

Not if you follow "Daily WTF" and see their Error'd posts :-)

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.