It's all about the answers!

Ask a question

Error while displaying linktypes


vinitha dsouza (1191154) | asked Feb 08 '17, 4:24 a.m.

Hello team

I am trying to get the list of all the linktypes using below code :
URI urilink = URI.create((GlobalConstants.getPROJECT_AREA()).replaceAll(
                " ", "%20"));
       
       
       
        Location location = Location.location(urilink);
    IReference itemHandles = IReferenceFactory.INSTANCE.createReferenceFromURI(location.toAbsoluteUri());
   
        final ILinkManager linkManager =(ILinkManager) teamRepository.getClientLibrary(ILinkManager.class);
       
       
                ILinkQueryPage queryPage = linkManager.findLinks(itemHandles, monitor);
               
                 ILinkCollection links = queryPage.getLinks();
                        for (ILink l : links) {
                IItemHandle linkHandle = (IItemHandle) l.getTargetRef().resolve();
                ILink link = (ILink)teamRepository.itemManager().fetchCompleteItem(linkHandle, IItemManager.DEFAULT, null);
                String linktype = link.getLinkTypeId();
               
                        }

but i get the following error :

Exception in thread "main" java.lang.IllegalStateException: Location was not constructed with absolute location information
    at com.ibm.team.repository.common.Location.toAbsoluteUri(Location.java:1222)
    at com.ccps.bosch.autoiteration.main.AutoIteration.main(AutoIteration.java:136)

anybody has any idea regarding this error???



2 answers



permanent link
Ralph Schoon (58.2k23642) | answered Feb 08 '17, 5:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Yes, you make false assumptions about how link types work. Not all are location based. To help beginners I created https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ and a tom of other posts. I would suggest you search that blog first if you want examples. 



Comments
vinitha dsouza commented Feb 08 '17, 6:04 a.m.

Hi Ralph

i was trying to get the flat list of linktypes in RTC ,I was unabbe to find client  libraries for the same ..

if i see the blogs ,all libraries are related to workitems where we get the linktypes  .
Is there any way where we get the flat list of LinkTypes  using Project area ?

Thank You


1
Ralph Schoon commented Feb 08 '17, 6:55 a.m. | edited Feb 08 '17, 6:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I don't know if there is a method to get all link types. That is not the question I tried to answer here. 


If you want that question answered, I would try com.ibm.team.links.common.registry.ILinkTypeRegistry.allEntries()


permanent link
vinitha dsouza (1191154) | answered Feb 08 '17, 7:39 a.m.

Hello Ralph

Thank you for the reply

I tried to hit  com.ibm.team.links.common.registry.ILinkTypeRegistry.allEntries()  but i get the below information :

[LinkTypeEntry for com.ibm.team.workitem.linktype.qm.relatedTestSuite:, source: com.ibm.team.links.common.internal.registry.EndPointDescriptor@2f80cb79, target: com.ibm.team.links.common.internal.registry.EndPointDescriptor@4816ee24,

Is it able to get the id and name of the Linktypes using this ?

eg : com.ibm.team.workitem.linktype.tracksworkitem.tracks -->Tracks

com.ibm.team.workitem.linktype.resolvesworkitem.resolvedBy---> Resolved By

Thank you in advance


Comments
Ralph Schoon commented Feb 08 '17, 8:22 a.m. | edited Feb 08 '17, 8:24 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 I don't know. I have never tried anything like that. Keep in mind that there is also localization involved. I Defined the display names I wanted on my own. You would have to look into the RTC Eclipse client UI if you want to find that out.

Your answer


Register or to post your answer.