It's all about the answers!

Ask a question

Access Custom LinkTypes via Java API?

Jamie Berry (14013693) | asked Oct 04 '12, 1:49 p.m.
I have created some new custom linktypes by following instructions on the forum and extending the extension point.  I have the linkTypes deployed to my server and my Eclipse client.  Now I need to find a way to access these links programatically.  I found references that say I should  use ILinkTypeRegistry.INSTANCE.getLinkType(<custom linktype>).  I tried this using the ID of the linktype I created in my extension.  The call above returns null.  I seem to remember seeing some mention of another step that needs to be taken if you want to access your linktypes from the API, but I can't find that now.

Does anyone know what needs to be done in order to make custom linktypes available through the Java API?



3 answers

permanent link
Lauren Hayward Schaefer (3.3k11727) | answered Oct 08 '12, 7:05 a.m.
Hi Jamie,
The following forum post has some sample code and links to another forum post that may be able to help you:

Jamie Berry commented Oct 08 '12, 12:39 p.m.

Thank you for the reply Lauren.  I had used that reference to start with along with related links.  I have received one reply from Ralph Schoon mentioning I might need to deploy my link type extension to the Plain Java Client Libraries somehow.  I have followed up with a question asking if he knows how to do that deployment.  I will ask the same question here, does anyone know how to make new client side process extensions (including new custom linktypes) available to Java apps written against the Plain Java Client API Libraries?


permanent link
sam detweiler (12.5k6195201) | answered Oct 14 '12, 9:03 a.m.
I was unable to find a way to get my custom linktype usable from PlainJava client code.

I added the plugin jar to classpath, but because it has no code there is no way to force load it.


Jamie Berry commented Oct 15 '12, 11:56 a.m.

Thank you for your reply. Have you investigated using the REST interface?  I am starting down that path as a co-worker believes the Visual Studio client relies on the REST interface and it has access to the linktypes (maybe it is just using web parts via REST that know how to work with them...)  Not being able to access the linktypes via external programs makes the linktypes less beneficial than we originally hoped.


Jamie Berry commented Oct 15 '12, 2:45 p.m.

An update...  I tried formulating a REST URL to get the data for a work item with the custom links, and it comes back with the links (in the form of <rtc_cm:{linktype endpoint id} oslc_cm:collref="{url to linked workitem}"/>).  So it looks like I will be able to access the custom links via REST.  Now I just need to learn how to work with the REST API via Java or Perl...

permanent link
Jamie Berry (14013693) | answered Oct 15 '12, 5:57 p.m.
Update yet again.  My co-worker helped me look at the Java API project and suggested that I add the .jar file for my extension to the directory with the Plain Java Client JAR files and then add the .jar file to my Java project build path.  Once I did that, I now have access to my custom linktypes from my Java code.  I get some warnings regarding Invalid icon URLs when it tries loading the linktype in$Impl createIconURL .  Other than the warning, things seem to be working just fine.  When I have some time, I will try cleaning up this warning...

Your answer

Register or to post your answer.