Error while displaying linktypes
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
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
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
I don't know if there is a method to get all link types. That is not the question I tried to answer here.
1 vote
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