Get instance of IssueLinkService?

tomkx December 20, 2013

How do I get an instance of IssueLinkService in the Jira API (version 5.1.8)?

3 answers

1 accepted

0 votes
Answer accepted
Aseem Parikh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 20, 2013

Import the interface in your class:

import com.atlassian.jira.bc.issue.link.IssueLinkService;

Then just add it to your constructor:

public MyPluginComponentImpl(ApplicationProperties applicationProperties, IssueLinkService issueLinkService)
    {
        this.applicationProperties = applicationProperties;
        this.issueLinkService = issueLinkService;
    }

Spring will autowire it for you.

tomkx December 20, 2013

Thanks Aseem,

but I am using the ScriptRunner plugin and trying to implement a post transition function with Groovy.

Aseem Parikh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2013

Ahhh...it would have been great to know that beforehand.

Try this instead:

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.bc.issue.link.IssueLinkService;

issueLinkService = ComponentManager.getComponentInstanceOfType(IssueLinkService.class);

0 votes
tomkx December 21, 2013

Thanks Aseem!!! That works like a charm.

0 votes
tomkx December 20, 2013

Thanks Aseem,

but I am using the ScriptRunner plugin and trying to implement a post transition function with Groovy.

Suggest an answer

Log in or Sign up to answer